akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define FORD(i, b, a) for (int i = b; i >= a; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPD(i, n) for (int i = n - 1; i >= 0; --i)
#define FORE(i, v) for (__typeof(v.begin()) i = v.begin(); i != v.end(); ++i)

#define sz(v) (int) v.size()
#define fi first
#define se second
#define all(v) v.begin(), v.end()

#define sqr(x) ((x) * (x))
#define EPS 1e-9
#define INF 1000000007ll
#define long long long

const int N = 1e5 + 10;

int n, ans;
int a[N];

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

    scanf("%d", &n);
    FOR(i, 1, n) {
        scanf("%d", &a[i]);
    }
    sort(a + 1, a + n + 1);
    long sum = 0;
    FOR(i, 1, n) {
        sum += a[i] << 1;
        if (sum < a[i + 1])
            ans = i;
    }
    printf("%d", n - ans);

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n;
	scanf("%lld",&n);
	long long v=1;
	int cnt=0;
	while(v<=n) v*=10,cnt++;
	v/=10,cnt--;
	int ans=cnt*9;
	for(int i=2;i<=10;i++){
		if(v*i-1<=n)
			ans++;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int i,ans=0,n,a,min=100;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a;
    while(a%2==0){
      a=a/2;
      ans++;
    }
    if(ans<min){
      min=ans;
    }
    ans=0;
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
  int n,i,j,flag=0;
  int A[100];
  int num,temp,count=0;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    num = i;
    for(j=i;j<n;j++){
      if(A[j]<A[num])
        num = j;
     }  
    if(i!=num){
      temp=A[i];    
      A[i]=A[num];
      A[num]=temp;
      count++;
      }
     }
    for(i=0;i<n;i++){
      if(i<n-1) printf("%d ",A[i]);
      else printf("%d\n",A[i]);
    }
    printf("%d\n",count);  
 
    return 0;
   }

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    string s;
    cin >> s;
    int ind = s.size() -1;
    vector<string> a = {"dream","dreamer","erase","eraser"};
    bool yes = true;
    while(ind>0){
        vector<bool> ok(4,1);
        rep(i,4){
            int t = a[i].size();
            if(ind - t + 1 < 0){
                //cout << "E1" << endl;
                continue;
            }
            rep(j,t){
                if(s[ind-j]==a[i][t-j-1]) continue;
                else {
                    //cout << "E2" << endl;
                    ok[i] = false;
                    break;
                }
            }
        }
        rep(i,4){
            if(ok[i]){
                ind -= a[i].size();
            }
        }
        if(ok[0]+ok[1]+ok[2]+ok[3]==0){
            //cout << "E3" << endl;
            yes = false;
            break;
        }
    }
    cout << (yes? "YES" : "NO") << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;

vector<ll> v[28];
vector<ll> v2;

int d[400001]={};
int t[400001]={};
const ll INF=1000000000000000001;
int main() {
	int n,m;

	cin>>n;
	for(int i=0;i<n;++i)cin>>d[i];
	cin>>m;
	for(int i=0;i<m;++i)cin>>t[i];
	sort(d,d+n);
	sort(t,t+m);
	int j=-1;
	bool flg=true;
	for(int i=0;i<m;i++){
		for(j++;(t[i]!=d[j])&&(j<n);++j);
		if(j>=n)flg=false;
	}
	if(flg){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}


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

int main(){
    int N;cin>>N;
    vector<ll> a(N),left(N+1),right(N+1);
    for(int i=0;i<N;i++)cin>>a.at(i);
    for(int i=1;i<=N;i++)left.at(i)+=left.at(i-1)+a.at(i-1);
    for(int i=N-1;i>=0;i--)right.at(i)=right.at(i+1)+a.at(i);
    ll now,ans=1e15;
    for(int i=1;i<N;i++){
        now=abs(left.at(i)-right.at(i));
        ans=min(ans,now);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    int64_t H, W;
    std::cin >> H >> W;

    int64_t ans = 0;
    if (H == 1 || W == 1) {
        ans = 1;
    } else if (H % 2 == 0) {
        ans = (H / 2) * W;
    } else {
        if (W % 2 == 0) {
            ans = (H / 2 + 1) * (W / 2) + (H / 2) * (W /2);
        } else {
            ans = (H / 2 + 1) * (W / 2 + 1) + (H / 2) * (W / 2);
        }
    }
    
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100001
#define none -1
typedef struct
{
	int parent;
  int leftch;
  int rightch;
}tree;

tree T[N];
int n;
int Depth(int ,int);
int Height(int);
int Degree(int);
int Sibling(int);
void Print(int);
int main()
{
	int i,node,left,right;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	T[i].parent=none;
	for(i=0;i<n;i++)
	{
	scanf("%d%d%d",&node,&left,&right);
	T[node].leftch=left;
	T[node].rightch=right;
	if(left!=none)
	T[left].parent=node;

	if(right!=none)
	T[right].parent=node;
	}	
	for(i=0;i<n;i++)
	Print(i);
	return 0;
}
int Depth(int A,int Dep)
{
	if(T[A].parent==none){ 
  }else{ 
		Dep++;
		Dep=Depth(T[A].parent,Dep);
	}
	return Dep;	
}

int Height(int A)
{
	int Hei1=0;
  int Hei2=0;
	if(T[A].leftch!=none)
	{
		Hei1++;
		Hei1=Hei1+Height(T[A].leftch);
	}
	if(T[A].rightch!=none)
	{
		Hei2++;
		Hei2=Hei2+Height(T[A].rightch);
	}
	return Hei1>Hei2?Hei1:Hei2;
}

int Degree(int A)
{
	if(T[A].leftch==none&&T[A].rightch==none)	
	return 0;
	else if(T[A].leftch!=none&&T[A].rightch!=none)
	return 2;
	else
	return 1;
}

int Sibling(int A)
{
	int B=T[A].parent;
	if(B==none||T[B].leftch==none||T[B].rightch==none)
	return -1;
	if(T[B].leftch==A)
	return T[B].rightch;
	else
	return T[B].leftch;
}

void Print(int A)
{
	printf("node %d: parent = %d, sibling = %d, degree = %d, ",A,T[A].parent,Sibling(A),Degree(A));
	printf("depth = %d, height = %d, ",Depth(A,0),Height(A));
	if(T[A].parent==-1)
	printf("root\n");
	else if(T[A].leftch==-1&&T[A].rightch==-1)	
	printf("leaf\n");
	else
	printf("internal node\n");
}


Measured memory_bytes: 2112
n = int(input())
p = list(map(float, input().split()))

dp = [0 for j in range(n + 1)]
dp[0] = 1
for i in range(n):
    pi = p[i]
    for j in range(i, -1, -1):
        dp[j + 1] = dp[j + 1] * pi + dp[j] * (1 - pi)
    dp[0] *= pi
print(sum(dp[:n // 2 + 1]))


Measured memory_bytes: 3316
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
 
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b){
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b){
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b){
	int res=1;
	while(b){
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=100002;
 
void solve(){
	string s;
	cin>>s;
	int n=s.length(),ans=0;
	for(int i=0;i<n/2;i++){
		if(s[i]!=s[n-i-1]){
			ans++;
		}
	}
	cout<<ans;
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize, w: usize, wv: [[i64; 2];n]};

    let wv: Vec<Vec<i64>> = wv;
    // 上、左に一列余分に空白をとってあげる
    let mut dp: Vec<Vec<i64>> = vec![vec![0; n + 1]; w + 1];

    for i in 1..w + 1 {
        for j in 1..n + 1 {
            if wv[j - 1][0] as usize <= i {
                dp[i][j] = std::cmp::max(
                    dp[i][j - 1],
                    dp[i - wv[j - 1][0] as usize][j - 1] + wv[j - 1][1],
                );
            } else {
                dp[i][j] = dp[i][j - 1];
            }
        }
    }

    println!("{}", dp[w][n]);
}


Measured memory_bytes: 84108
import math 

a,b,h,m = map(float,input().split())

theta = min(360-abs(6*m-30*h-0.5*m),abs(6*m-30*h-0.5*m))
ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(theta)))

print(ans)

Measured memory_bytes: 9440
a,b=map(int,input().split())
c,d=map(int,input().split())
e,f=map(int,input().split())
L=[a,b,c,d,e,f]
R=set(L)
if len(R)==4 and L.count(1)<3 and L.count(4)<3 and L.count(3)<3 and L.count(2)<3:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 9100
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeWordScanner()
	s := eGetLine(scanner)
	w := []string{"Sunny", "Cloudy", "Rainy"}
	for i := 0; i < len(w); i++ {
		if s == w[i] {
			fmt.Println(w[(i+1)%3])
		}
	}
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>

int main(){
  
  int a;
  int b;
  int c,
    d;
  
  while(scanf("%d %d",&a,&b)!=EOF){
  
    // while(a[i]!=0){
    c=a+b;
    d=0;
    while(c!=0){
      c/=10;
      d++;
    }
    printf("%d\n",d);
  }
   
  return 0;
}

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

string compare(string S, string A) {
    string X;
	for (int i = 0; i < S.size(); i++) {
		if (A.find(S[i])!=-1) {
			A.erase(A.find(S[i]),1);
			X+=S[i];
		}
	}

	return X;
}




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

	string S, A;
	cin >> S;

	for (int i = 0; i < n - 1; i++) {
		cin >> A;

		S = compare(S, A);
	}
    
    sort(S.begin(),S.end());
	cout << S << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};
constexpr char BR = '\n';

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())


template <class T> inline int argmin(vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){a = max(a, b);}
template <class T> inline void chmin(T &a, T b){a = min(a, b);}
inline int toInt(string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline int toInt(const string s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res = "";
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

constexpr int MAX_SIZE = 1e5 + 1;
int n, L;
Vint X(MAX_SIZE);


int judge(void){
   REP(i, n-1) if(X[i] + X[i + 1] >= L) return i;
   return -1;
}

int main(void){
  cin >> n >> L;
  REP(i, n) cin >> X[i];
  int u = judge();
  if(u == -1) std::cout << "Impossible" << BR;
  else{
    std::cout << "Possible" << BR;
    for(int i = 0; i != u; i++) std::cout << i + 1 << BR;
    for(int i = n-2; i != u; i--) std::cout << i + 1 << BR;
    std::cout << u + 1 << BR;
  }
  return 0;
}

Measured memory_bytes: 1280
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn operate(s: &mut [Vec<char>], x: usize, y: usize) {
    let t = s[x].clone();
    for (i, c) in t.into_iter().enumerate() {
        s[i][y] = c;
    }
}

fn run() {
    input! {
        n: usize,
        s: [chars; n],
    }
    if s.iter().all(|s| s.iter().all(|c| *c == '.')) {
        println!("-1");
        return;
    }
    let mut ans = std::usize::MAX;
    for i in 0..n {
        let mut s = s.clone();
        let mut cnt = 0;
        if s[i][i] != '#' {
            for j in 0..n {
                if s[j][i] == '#' {
                    cnt += 1;
                    operate(&mut s, j, i);
                    break;
                }
            }
        }
        if s[i][i] == '.' {
            cnt += 2;
            s[i][i] = '#';
        }
        for j in 0..n {
            if s[i][j] != '#' {
                cnt += 1;
                operate(&mut s, i, j);
            }
        }
        for j in 0..n {
            for k in 0..n {
                if s[k][j] != '#' {
                    cnt += 1;
                    operate(&mut s, i, j);
                    break;
                }
            }
        }
        ans = std::cmp::min(ans, cnt);
    }
    println!("{}", ans);
}

fn main() {
    run();
}


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

using namespace std;

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

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n;
vector<pii> g[125252];
int c[125252];

void dfs(int p, int bef, int x){
    c[p] = x;
    for(pii P : g[p])if(P.first != bef){
        int to = P.first;
        int w= P.second;
        dfs(to,p,x ^ (w%2));
    }
}

int main(){
    scanf("%d",&n);
    REP(i,n-1){
        int u,v,w;
        scanf("%d%d%d",&u,&v,&w);
        --u; --v;
        g[u].push_back(pii(v,w));
        g[v].push_back(pii(u,w));
    }
    dfs(0,-1,0);
    REP(i,n)printf("%d\n",c[i]);
    return 0;
}


Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))


int main(){
    int n;  cin >> n;
    string s1, s2;  cin >> s1 >> s2;

    ll ans=3;
    if(s1[0]!=s2[0]) ans *= 2;
    FOR(i, 1, s1.size()){
        if(s1[i-1]!=s1[i]) {
            if(s1[i-1]==s2[i-1]) ans *= 2;
            else if(s1[i]!=s2[i]) ans *= 3;
        } 
        ans %= MOD;
        
    }

    cout << ans << endl;
}

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

int main(){
  int N;
  cin >> N;
  bool flag = false;
  for(int i = 1; i < 10; i++){
    if(N % i == 0 && N / i < 10) flag = true;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

class UnionFind {
	vector<int>parent;
	vector<int>rank;
public:
	UnionFind(int num) {
		num++;
		parent.resize(num);
		rank.resize(num);
		for (int i = 0; i < num; i++) {
			parent[i] = i;
			rank[i] = 0;
		}
	}
	int Find(int node) {
		if (parent[node] == node)return node;
		else return parent[node] = Find(parent[node]);
	}
	void Unite(int u, int v) {
		u = Find(u);
		v = Find(v);
		if (u == v)return;
		if (rank[u] < rank[v])parent[u] = v;
		else {
			parent[v] = u;
			if (rank[u] == rank[v])rank[u]++;
		}
	}
	bool Check_Same(int u, int v) {
		return Find(u) == Find(v);
	}
};

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

	cin >> N >> M >> K;
	vector<vector<int>>edge(N);
	UnionFind uf(N);
	vector<int>num(N);
	for (int i = 0; i < M; i++) {
		cin >> L >> R;
		L--, R--;
		uf.Unite(L, R);
		num[L]++;
		num[R]++;
	}
	for (int i = 0; i < K; i++) {
		cin >> L >> R;
		L--, R--;
		edge[L].push_back(R);
		edge[R].push_back(L);
	}
	vector<int>sz(N);
	for (int i = 0; i < N; i++) {
		sz[uf.Find(i)]++;
	}
	for (int i = 0; i < N; i++) {
		int ans = sz[uf.Find(i)] - 1 - num[i];
		for (auto j : edge[i]) {
			if (uf.Check_Same(i, j))ans--;
		}
		cout << ans << " ";
	}
	cout << endl;
	return 0;
}

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

int main () {
    int digits[3];
    scanf("%d%d%d", digits, digits +1, digits +2);
    sort(digits, digits+3);
    int ans = 10 * digits[2] + digits[0] + digits[1];
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int N, A, B;
  cin >> N >> A >> B;
  vector<int> question_count(3, 0);
  rep(i, N)
  {
    int P;
    cin >> P;
    if (P < A + 1)
      question_count[0]++;
    else if (P < B + 1)
      question_count[1]++;
    else
      question_count[2]++;
  }
  int ans = min({question_count[0], question_count[1], question_count[2]});
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;
const ll inf = 1e18;

int n;
vector<ll> pos, neg;
ll k;

template <class T>
inline void read(T &x) {
	x = 0;
	char ch = getchar(), w = 0;
	while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
	while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	x = w ? -x : x;
	return;
}

inline int check(ll mid) {
	ll ret = 0;
	if (mid < 0) {
		auto i = pos.begin(), j = neg.begin();
		while (i != pos.end()) {
			while (j != neg.end() && *i * *j <= mid) ++j;
			ret += j - neg.begin(), ++i;
		}
		return ret >= k;
	}
	auto i = pos.begin();
	auto j = pos.rbegin();
	while (i != pos.end()) {
		while (j != pos.rend() && *i * *j > mid) ++j;
		ret += pos.rend() - j, ++i;
	}
	i = neg.begin(), j = neg.rbegin();
	while (i != neg.end()) {
		while (j != neg.rend() && *i * *j <= mid) ++j;
		ret += j - neg.rbegin(), ++i;
	}
	for (auto &k : pos)
		if (k * k <= mid) --ret;
	for (auto &k : neg)
		if (k * k <= mid) --ret;assert(~ret & 1);
	ret >>= 1;
	ret += (ll) pos.size() * neg.size();
	return ret >= k;
}

int main() {
	int x;
	read(n), read(k);
	for (R int i = 1; i <= n; ++i) {
		read(x);
		(x < 0 ? neg : pos).push_back(x);
	}
	sort(neg.begin(), neg.end());
	sort(pos.begin(), pos.end());
	if (check(-1)) {
		ll l = -inf, r = -1, mid;
		while (l != r) mid = (l + r - 1) / 2, check(mid) ? r = mid : l = mid + 1;
		printf("%lld\n", l);
		return 0;
	}
	ll l = 0, r = inf, mid;
	while (l != r) mid = (l + r) / 2, check(mid) ? r = mid : l = mid + 1;
	printf("%lld\n", l);
	return 0;
}

Measured memory_bytes: 2548
from collections import deque

def main():
    h, w, n = map(int, input().split())
    mp = [list("#" * (w + 2))] + [list("#" + input() + "#") for _ in range(h)] + [list("#") * (w + 2)]
    init_body = [None] * 4
    for y in range(1, h + 1):
        for x in range(1, w + 1):
            if mp[y][x] == "S":
                init_head = (x, y)
                mp[y][x] = "."
            if mp[y][x] == "e":
                mp[y][x] = "."
            if "a" <= mp[y][x] <= "d":
                init_body[ord(mp[y][x]) - ord("a")] = (x, y)
                mp[y][x] = "."
            if "1" <= mp[y][x] <= "9":
                mp[y][x] = int(mp[y][x])
    
    que = deque()
    que.append((0, init_head, init_body, 1))
    mem = {}
    mem[(init_head, tuple(init_body), 1)] = 0
    vec = ((1, 0), (0, -1), (-1, 0), (0, 1))
    while que:
        score, head, body, target = que.popleft()
        if target > n:
            print(score)
            break
        x, y = head
        for dx, dy in vec:
            nx, ny = x + dx, y + dy
            if (nx, ny) in body:continue
            if mp[ny][nx] == "#":continue
            new_target = target
            if mp[ny][nx] == target:new_target += 1
            new_body = tuple([head] + list(body)[:-1])
            if ((nx, ny), new_body, new_target) not in mem:
                mem[((nx, ny), new_body, new_target)] = True
                que.append((score + 1, (nx, ny), new_body, new_target))
    else:
        print(-1)


main()


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

using namespace std;

int main(void)
{
    int N, i, p[11], ans=0;

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> p[i];

        ans += p[i];
    }

    sort(p+1, p+N+1);

    ans -= p[N]/2;

    cout << ans << endl;

    return 0;
}

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

typedef long long ll;

int N;
ll A[200020];
ll ans = 2000000000000000000,sum = 0;

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++){scanf("%lld",&A[i]);sum += A[i];}
    ll now = 0;
    for(int i = 0; i < N - 1; i++)
    {
        now += A[i];
        ans = min(ans,abs(now - (sum - now)));
    }
    printf("%lld\n",ans);
    return 0;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

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

struct Edge {
  const int from, to;
  Edge(int from, int to) : from(from), to(to) {}
};

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

  int n;
  cin >> n;
  vector<vector<Edge>> graph(n);
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < n; j++) {
      if (s[j] == '1') {
        graph[i].push_back(Edge(i, j));
      }
    }
  }

  auto solve_fn = [&](int r) -> int {
    // cout << "r: " << r << endl;
    deque<int> queue;
    queue.push_back(r);
    vector<int> ds(n, INT_MAX);
    ds[r] = 0;
    // cout << "ds[1]: " << ds[1] << endl;
    while (!queue.empty()) {
      int v = queue.front();
      // cout << "v: " << v << endl;
      queue.pop_front();
      for (const auto& e : graph[v]) {
        // cout << "v: " << v << " e.to: " << e.to << endl;
        if (ds[e.to] < INT_MAX) {
          if (ds[e.to] != ds[v] - 1 && ds[e.to] != ds[v] + 1) {
            // cout << "ds[e.to]: " << ds[e.to] << endl;
            // cout << "ds[v]: " << ds[v] << endl;
            // cout << "v: " << v << " e.to: " << e.to << endl;
            return -1;
          }
          continue;
        }
        ds[e.to] = ds[v] + 1;
        queue.push_back(e.to);
      }
    }
    int max = 0;
    for (int d : ds) UpdateMax(max, d);
    return max + 1;
  };

  int ans = -1;
  for (int i = 0; i < n; i++) UpdateMax(ans, solve_fn(i));
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>

using namespace std;

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

int main(){
    int n;
    cin >> n;
    double a[n];
    rep(i, n) cin >> a[i];
    double ans = 0;
    rep(i, n) ans += 1 / a[i];
    ans = 1 / ans;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
int main()
{
	long x,y,m=1145141919;
	cin>>x>>y;
	if(y-x>=0)m=min(m,y-x);
	if(y+x>=0)m=min(m,y+x+1);
	if(-y-x>=0)m=min(m,-y-x+1);
	if(-y+x>=0)m=min(m,-y+x+2);
	cout<<m<<endl;
}

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

using namespace std;
using ll = long long;

int main()
{
    string s, t;
    ll k, l, m;
    ll num;
    vector<ll> pos[26], alph_num(26), t_pos;

    cin >> s >> t;
    ll s_len = s.length();
    ll t_len = t.length();
    
    for(ll i=0; i<s_len; ++i) pos[s[i]-'a'].push_back(i);
    for(ll i=0; i<26; ++i) alph_num[i] = pos[i].size();

    num = -1; m = 0;
    for(ll i=0; i<t_len; ++i){
        k = t[i] - 'a';
        if(alph_num[k] == 0){
            m = -1;
            break;
        }
        l = upper_bound(pos[k].begin(), pos[k].end(), num) - pos[k].begin();
        if(l == alph_num[k]) num = pos[k][0];
        else num = pos[k][l];
        t_pos.push_back(num);
    }

    if(m != -1){
        m = 0;
        for(ll i=0; i<t_len-1; ++i){
            if(t_pos[i]>=t_pos[i+1]) m += s_len;
        }
        m = m + t_pos[t_len-1] + 1;
    }

    cout << m << endl;

    return 0;
}

Measured memory_bytes: 2872
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,m,i,a,b
    integer(int32), allocatable:: e(:)
    logical:: yes

    read*, n,m
    allocate(e(n), source=0)
    do i=1, m
        read*, a,b
        e(a)=e(a)+1; e(b)=e(b)+1
    end do

    yes = .true.

    do i=1,n
        yes = yes .and. mod(e(i),2) == 0
    end do

    if (yes) then
        print'(a)', 'YES'
    else
        print'(a)', 'NO'
    end if
end program main

Measured memory_bytes: 3256
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  int n;
  cin >> n;
  cout << pow(n, 3);
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) return 0;
    vector<int> x(n),y(n),r(n),c(n);
    for(int i=0;i<n;i++){
      cin >> x[i] >> y[i] >> r[i] >> c[i];
    }
    vector<list<int>> ue(n);
    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
        if((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])<(r[i]+r[j])*(r[i]+r[j])){
          ue[j].push_back(i);
        }
      }
    }
    queue<int> bfs;
    bfs.push(0);
    vector<bool> ok(1<<n,false);
    ok[0]=true;
    int now;
    vector<int> can;
    while(!bfs.empty()){
      now=bfs.front();
      bfs.pop();
      can={};
      for(int i=0;i<n;i++){
        if(!(now&(1<<i))){
          for(auto j:ue[i]){
            if(!(now&(1<<j))){
              goto next;
            }
          }
          can.push_back(i);
          next:
          continue;
        }
      }
      for(int i=0;i<can.size();i++){
        for(int j=i+1;j<can.size();j++){
          if(c[can[i]]==c[can[j]]){
            if(!ok[now|(1<<can[i])|(1<<can[j])]){
              ok[now|(1<<can[i])|(1<<can[j])]=true;
              bfs.push(now|(1<<can[i])|(1<<can[j]));
            }
          }
        }
      }
    }
    int ans=0,k,tmp;
    for(int i=0;i<(1<<n);i++){
      if(ok[i]){
        k=i,tmp=0;
        while(k){
          if(k%2) tmp++;
          k/=2;
        }
        ans=max(ans,tmp);
      }
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 6700
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int a,b,c,d; cin >> a >> b >> c >> d;
	cout << a+b+c+d << endl;
}


Measured memory_bytes: 3148
using System;
using System.Collections.Generic;

namespace cswork {
    class Program {
        static void Main (string[] args) {
            List<long> ll = ReadList ();
            long x = ll[0] * ll[1];
            long y = ll[2] * ll[3];

            if (x > y) {
                Write (x);
            } else {
                Write (y);
            }
            Exit ();
        }

        public static void Write (string str) {
            Console.WriteLine (str);
        }

        public static void Write (int i) {
            Console.WriteLine (i);
        }

        public static void Write (double d) {
            Console.WriteLine (d);
        }

        public static string ReadStr () {
            return Console.ReadLine ();
        }

        public static int ReadInt () {
            return int.Parse (Console.ReadLine ());
        }

        public static long Read () {
            return long.Parse (Console.ReadLine ());
        }

        public static double ReadDouble () {
            return double.Parse (Console.ReadLine ());
        }

        public static void Exit () { }

        public static List<string> ReadListStr () {
            return new List<string> (ReadStr ().Split (" "));
        }

        public static List<long> ReadList () {
            return ReadListStr ().ConvertAll (x => long.Parse (x));
        }

        public static List<int> ReadListInt () {
            return ReadListStr ().ConvertAll (x => int.Parse (x));
        }
    }
}

Measured memory_bytes: 27924
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#define N 105
#define PI 3.14159265
using namespace std;

typedef long long ll;
ll n, px, py, mx;
ll f(ll p, ll q) {
	return p * p + q * q;
}

struct st {
	ll x, y;
	double ta;
} a[N];

bool comp(st p, st q) {
	return p.ta < q.ta;
}

int main()
{
	ll i, j, t;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf ("%lld %lld", &a[i].x, &a[i].y);
		a[i].ta = atan2(a[i].y, a[i].x);
	}
	sort(a, a + n, comp);
	for (i = 0; i < n; i++) {
		px = a[i].x;
		py = a[i].y;
		for (j = 1; j < n; j++) {
			t = (i + j) % n;
			if (f(px, py) < f(px + a[t].x, py + a[t].y)) {px += a[t].x; py += a[t].y;}
		}
		mx = max(mx, px * px + py * py);
	}
	printf("%.15f\n", sqrt(mx));
    return 0;
}


Measured memory_bytes: 4132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
const int INF = 1000000001;

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

Measured memory_bytes: 256
from collections import deque
H, W = map(int, input().split())
s = [list(input()) for i in range(H)]
Q = deque()
Q.append([0, 0])
dist = [[-1] * W for i in range(H)]
dist[0][0] = 0
c = 0
for i in range(H):
    for j in range(W):
        if s[i][j] == '.':
            c += 1

yudrl = [0, 1, 0, -1]
xudrl = [1, 0, -1, 0]

while (len(Q) > 0):
    q = Q.popleft()

    for i in range(4):
        y = q[0] + yudrl[i]
        x = q[1] + xudrl[i]

        if y < 0 or y > H - 1 or x < 0 or x > W - 1:
            continue  
        if dist[y][x] != -1 or s[y][x] == '#':
            continue
        dist[y][x] = dist[q[0]][q[1]] + 1
        Q.append([y, x])
if dist[H - 1][W - 1] == -1:
    print('-1')
else:
    print(c - dist[H - 1][W - 1] - 1)

Measured memory_bytes: 3316
fun main(args: Array<String>) {
    val a = readLine()!!.split(" ").map { it.toInt() }
    val dx=a[2]-a[0]
    val dy=a[3]-a[1]

    val sb=StringBuilder()
    repeat(dx){ sb.append('R') }
    repeat(dy){ sb.append('U') }
    repeat(dx){ sb.append('L') }
    repeat(dy){ sb.append('D') }
    sb.append('D')
    repeat(dx+1){ sb.append('R') }
    repeat(dy+1){ sb.append('U') }
    sb.append('L')
    sb.append('U')
    repeat(dx+1){ sb.append('L') }
    repeat(dy+1){ sb.append('D') }
    sb.append('R')
    sb.append("\n")
    println(sb)
}

Measured memory_bytes: 37872
#include<bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(10) << ans << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n,m;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


signed main(){
    int z,w;
    cin >> n >> z >> w;
    vec(a,n);
    input(a,n);
    if(n==1){
        print(abs(a[0]-w));
    }
    else{
        int tmpa = abs(a[n-1]-a[n-2]);
        int tmpb = abs(w-a[n-1]);
        print(max(tmpa,tmpb));

    }
    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


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


int main(){
	int a,b;
	cin >> a >> b;
	
	if(b%a==0) cout << a+b << endl;
	else cout << b-a << endl;
	return 0;
}

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

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, a, b; cin >> n;
    int mx = 0, cnt = 0;

    for(int i=0; i<n; ++i)
    {
        cin >> a >> b;

        if(a == b) cnt++;
        else cnt = 0;

        mx = max(cnt,mx);
    }
    cout << ((mx>=3)? "Yes" : "No") << endl;


    return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
int main()
{
    int a,b;
    do{
        scanf("%d %d",&a,&b);
        if(a==0 && b==0)
        break;
        for(int i=0;i<a;i++)
        {
            for(int j=0;j<b;j++)
            {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }while(a!=0 && b!=0);
}


Measured memory_bytes: 1932
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"	
	typedef long long LL;
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define mod2 998244353
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define sz(v) ((ll)(v).size())
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define pb push_back
	#define f first
	#define s second
	#define dbg(a) cout<<#a<<" --> "<<(a)<<"\n";
	#define forn(i,n) for (ll i=0; i<(n); ++i)
	#define fornd(i,n) for (ll i=(n)-1; i>=0; --i)	
	#define forab(i,a,b) for (ll i=(a); i<=(b); ++i)
	#define read(a) ll a; cin >> a;
	#define reads(s) string s; cin >> s;
	#define readb(a, b) ll a, b; cin >> a >> b;
	#define readc(a, b, c) ll a, b, c; cin >> a >> b >> c;
	#define readarr(a, n) int a[(n) + 1] = {}; forab(i, 0, (n-1)) {cin >> a[i];}
	#define readmat(a, n, m) int a[n + 1][m + 1] = {}; forab(i, 1, n) {forab(j, 1, m) cin >> a[i][j];}
	#define readv(A,n) vll A(n,0); forn(i,n) cin>>A[i]; 
	#define print(a) cout << a << endl;
	#define printarr(a, n) forab (i, 1, n) cout << a[i] << " "; cout << endl;
	#define printv(v) for (int i: v) cout << i << " "; cout << endl;
	#define printmat(a, n, m) forab(i, 1, n) {forab (j, 1, m) cout << a[i][j] << " "; cout << endl;}
	 
	#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
	using namespace std;
	bool isPowerOfTwo(int x) {
    return x && (!(x & (x - 1)));
	}
	int takemod(int x) {
    return (x % mod + mod) % mod;
	}
 
	int fpow(int base, int power, int MOD) {
    int result = 1;
    base = base % MOD;
    while (power) {
        if (power & 1)
            result = (result * base) % MOD;
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result;
	}
 
	int modinv(int x) {return fpow(x, mod - 2, mod);}
	void solve()
	{
		ll n;
		cin>>n;
		vll A(n);
		forn(i,n)cin>>A[i];
		ll dp[100010];
		mem(dp,0);
		dp[0]=0;
		dp[1]=abs(A[1]-A[0]);
		if(n>=2)
		{

			forab(i,2,n-1)
			{
				dp[i]=min(dp[i-1]+abs(A[i]-A[i-1]),dp[i-2]+abs(A[i]-A[i-2]));
			}
		}
		cout<<dp[n-1]<<endl;
	}
	int main()
	{	
		// #ifndef ONLINE_JUDGE
		// freopen("input.txt","r",stdin);
		// freopen("output.txt","w",stdout);
		// #endif
		fast_io;
		int T=1;
		//cin>>T;
		// cin.ignore(); must be there when using getline(cin, s)
		while(T--)
		{
			solve();
		}
		return 0;
	}

	
	

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

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


signed main(){
    int n;
    cin >> n;
    vector<int> u(n - 1), v(n - 1), w(n - 1);
    vector<vector<pair<int,int>>> edges(n);
    for(int i = 0; i < n - 1; ++i){
        cin >> u[i] >> v[i] >> w[i];
        --u[i], --v[i];
        edges[u[i]].emplace_back(v[i], w[i]);
        edges[v[i]].emplace_back(u[i], w[i]);
    }
    vector<i64> dist(n, INF);
    function<void(int)> f = [&](int x){
        for(auto p : edges[x]){
            int y, d;
            tie(y, d) = p;
            if(dist[y] == INF){
                dist[y] = dist[x] + d;
                f(y);
            }
        }
    };
    dist[0] = 0;
    f(0);
    for(int i = 0; i < n; ++i)
        cout << dist[i] % 2 << endl;
}


Measured memory_bytes: 10496
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

int n, m, k, u, v, x, y, t, a, b, ans;
int A[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>x;
	while (1){
		k+=x;
		ans++;
		if (k%360==0) break ;
	}
	cout<<ans<<'\n';
	
	return 0;
}


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

LL A, B, C, D;
map<LL, LL> memo;
LL solve(LL N) {
    if (N == 0) return 0;
    if (N == 1) return D;
    if (memo.count(N)) return memo[N];
    LL l2 = (N/2)*2;
    LL r2 = ((N+1)/2)*2;
    LL l3 = (N/3)*3;
    LL r3 = ((N+2)/3)*3;
    LL l5 = (N/5)*5;
    LL r5 = ((N+4)/5)*5;

    LL res = 1e18;
    if (N < res/D) res = N*D;
    res = min(res, llabs(l2-N)*D + A + solve(l2/2));
    res = min(res, llabs(r2-N)*D + A + solve(r2/2));

    res = min(res, llabs(l3-N)*D + B + solve(l3/3));
    res = min(res, llabs(r3-N)*D + B + solve(r3/3));

    res = min(res, llabs(l5-N)*D + C + solve(l5/5));
    res = min(res, llabs(r5-N)*D + C + solve(r5/5));

    memo[N] = res;

    return res;
}

int main() {
    int T;
    cin >> T;
    for (int t = 0; t < T; t++) {
        memo.clear();
        LL N;
        cin >> N;
        cin >> A >> B >> C >> D;
        cout << solve(N) << "\n";
    }
}

Measured memory_bytes: 4464
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

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

    static class LikeNumber {
        boolean[] primes;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            primes = eratos((int) Math.pow(10, 5));
            int[] score = new int[(int) Math.pow(10, 5) + 1];

            int total = 0;
            for (int i = 0; i <= (int) Math.pow(10, 5); i++) {
                if (primes[i] && primes[(i + 1) / 2]) {
                    total++;
                }
                score[i] = total;
            }

            int q = in.nextInt();
            for (int i = 0; i < q; i++) {
                int s = in.nextInt() - 1;
                int e = in.nextInt();
                long result = score[e] - score[s];
                out.println(result);
            }
        }

        static boolean[] eratos(int n) {
            boolean[] results = new boolean[n + 1];
            Arrays.fill(results, true);

            results[0] = false;
            results[1] = false;

            for (int i = 2; i <= n; i++) {
                int j = i + i;
                while (j <= n) {
                    results[j] = false;
                    j = j + i;
                }
            }
            return results;
        }

    }
}



Measured memory_bytes: 58492