akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
class Main {
	static int[][] map;
	static int[][] map2;
	static int[] vx = new int[] {0,1,-1,1,0,1};
	static int[] vy = new int[] {-1,-1,0,0,1,1};
	
	static int[] vx2 = new int[] {-1,0,-1,1,-1,0};
	static int[] vy2 = new int[] {-1,-1,0,0,1,1};
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int m = sc.nextInt();
			int n = sc.nextInt();
			if(m == 0 && n == 0) break;
			map = new int[n][m];
			map2 = new int[n][m];
			for(int i = 0; i < n; i++) {
				Arrays.fill(map[i], 2 << 27);
				Arrays.fill(map2[i], -1);
			}
			int s = sc.nextInt();
			for(int i = 0; i < s; i++) {
				int x = sc.nextInt()-1;
				int y = sc.nextInt()-1;
				solv(y,x,0,i);
			}

			
			
			int max = 0;
			int t = sc.nextInt();
			for(int i = 0; i < t; i++) {
				int[][] tmpMap = new int[n][];
				int[][] tmpMap2 = new int[n][];
				for(int j = 0; j < n; j++) {
					tmpMap[j] = Arrays.copyOf(map[j], map[j].length);
					tmpMap2[j] = Arrays.copyOf(map2[j], map2[j].length);
				}
				int x = sc.nextInt()-1;
				int y = sc.nextInt()-1;
				solv(y,x,0,-2);
				int ret = count();
				if(ret > max) { 
					max = ret;
				}
				
				map = tmpMap;
				map2 = tmpMap2;
			}
			System.out.println(max);
			
		}
	}
	static void solv(int y ,int x, int count,int id) {
		if(map[y][x] < count) return;
		if(map[y][x] == count && map2[y][x] != id) {
			map2[y][x] = -10;
			return;
		}
		if(map[y][x] == count) {
			return;
		}
		map[y][x] = count;
		map2[y][x] = id;
		
		for(int i = 0; i < 6; i++) {
			int tmpy;
			int tmpx;
			if(y % 2 == 1) {
				tmpy = y + vy[i];
				tmpx = x + vx[i];
			}
			else {
				tmpy = y + vy2[i];
				tmpx = x + vx2[i];
			}
			
			if(!check(tmpy,tmpx)) continue;
			solv(tmpy,tmpx,count+1,id);
		}
	}
	
	static boolean check(int y, int x) {
		if(y < 0 || x < 0 || y >= map.length || x >= map[y].length) return false;
		return true;
	}
	
	static int count() {
		int ret = 0;
		for(int i = 0; i < map.length; i++) {
			for(int j = 0; j < map[i].length; j++) {
				if(map2[i][j] == -2) ret++;
			}
		}
		return ret;
	}
}

Measured memory_bytes: 22888
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

int main(void)
{
    int A, B;
    cin >> A >> B;

    int ans;
    if (A + B >= 24)
    {
        ans = A + B - 24;
    }
    else
    {
        ans = A + B;
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>
typedef struct node{
  struct node *r;
  struct node *l;
  struct node *parent;
  int key;
}node;
typedef struct node * Node;

int pre(Node);

int mid(Node);

Node nose(int);

int in(Node,int);

void freedom(Node);

int main(){
  int j,n,i,ndnm;
  char b[7];
  Node first,now;
  scanf("%d",&n);
  scanf("%s %d",b,&ndnm);
  first = nose(ndnm);
  for(i=0;i<n-1;i++){
    scanf("%s",b);
    if(b[0]=='i'){
      scanf("%d",&ndnm);
      in(first,ndnm);
    }else{
      mid(first);
      printf("\n");
      pre(first);
      printf("\n");
    }
  }
freedom(first);

}
int in(Node now,int ndnm){
  while(1){
//printf("now =%d ",now->key);
    if(ndnm >= now->key){
      if(now->r != NULL)
	now = now->r;
      else{
	now->r=nose(ndnm);
	break;
      }
    }else{
      if(now->l != NULL)
	now = now->l;
      else{
	now->l=nose(ndnm);
	break;
      }
    }
  }
return 0;
}
Node nose(int key){

Node set;
set =(Node)malloc(sizeof(node));
  set->key=key;
  set->r=NULL;
  set->l=NULL;
  return set;
}

int mid(Node a){
  if(a->l != NULL)
    mid(a->l);
  printf(" ");
  printf("%d",a->key);
  if(a->r !=NULL)
    mid(a->r);
  return 0;
}


int pre(Node a){
  printf(" ");
  printf("%d",a->key);
  if(a->l != NULL)
    pre(a->l);
  if(a->r !=NULL)
    pre(a->r);
  return 0;
}

void freedom(Node a){
  if(a->l != NULL)
    free(a->l);
  if(a->r !=NULL)
    free(a->r);
free(a);
}




Measured memory_bytes: 25160
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello{
    public static void Main(){
        var input = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var n = input[0];
        var h = input[1];
        var w = input[2];
        long count = 0;
        
        for(var i = 0;i < n;i++){
            var size = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var a = size[0];
            var b = size[1];
            
            if(a >= h && b >= w){
                count++;
            }
        }
        Console.WriteLine(count);
        
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    int N, D, X; IN(N, D, X);
    vector<int> A(N);
    rep(i, 0, N) cin >>A[i];
    int cnt = X;
    rep(i, 0, N){
        cnt++;
        cnt += (D - 1) / A[i];
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String c_str = in.readLine();

    int r_count = 0;
    for(int i=0; i<n; i++) {
      if(c_str.charAt(i) == 'R')
        r_count++;
    }

    String c_splt = c_str.substring(0,r_count);
    String[] c_splt_ary = c_splt.split("");
    int ans = 0;
    for(int i=0; i<r_count; i++) {
      if(c_splt_ary[i].equals("W"))
        ans++;
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 49308
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
#define ll long long
using namespace std;
const int Maxn=2000000;
struct edge{
	int v,nxt,c;
}e[Maxn<<1|5];
int p[Maxn+5],eid;
void init(){
	memset(p,-1,sizeof p);
	eid=0;
}
void insert(int u,int v,int c){
	e[eid].v=v;
	e[eid].c=c;
	e[eid].nxt=p[u];
	p[u]=eid++;
}
int l,r,a[Maxn+5],siz[Maxn+5],msize[Maxn+5],vis[Maxn+5],w[Maxn+5],dis[Maxn+5],szz;
void dfs(int u,int fa){
	msize[u]=0;
	a[++r]=u;
	siz[u]=1;
	for(int i=p[u];i+1;i=e[i].nxt){
		int v=e[i].v,c=e[i].c;
		if(vis[v]||v==fa){
			continue;
		}
		dfs(v,u);
		siz[u]+=siz[v];
		if(siz[v]>msize[u]){
			msize[u]=siz[v];
		}
	}
}
void dfss(int u,int fa,ll sum){
	dis[u]=sum; 
	for(int i=p[u];i+1;i=e[i].nxt){
		int v=e[i].v,c=e[i].c;
		if(v==fa||vis[v]){
			continue;
		}
		dfss(v,u,sum+c);
	}
}
struct AA{
	int u,v;
	ll c;
}ee[Maxn<<3|5];
void solve(int u){
	l=1;
	r=0;
	dfs(u,u);
	int sz=siz[u];
	for(int i=1;i<=r;i++){
		int v=a[i];
		if(max(msize[v],sz-siz[v])<max(msize[u],sz-siz[u])){
			u=v;
		}
	}
	dis[u]=0;
	vis[u]=1;
	for(int i=p[u];i+1;i=e[i].nxt){
		int v=e[i].v;
		if(vis[v]){
			continue;
		}
		dfss(v,u,e[i].c);
	}
	int ma=u;
	for(int i=l;i<=r;i++){
		int v=a[i];
		if(dis[v]+w[v]<dis[ma]+w[ma]){
			ma=v;
		}		
	}
	for(int i=l;i<=r;i++){
		int v=a[i];
		if(v==ma){
			continue;
		}
		ee[++szz]={ma,v,w[ma]+w[v]+dis[v]+dis[ma]};
	}
	for(int i=p[u];i+1;i=e[i].nxt){
		int v=e[i].v;
		if(vis[v]){
			continue;
		}
		solve(v);
	}
}
int cmp(AA x,AA y){
	return x.c<y.c;
}
int fa[Maxn+5],n;
int get(int x){
	return fa[x]==x?x:fa[x]=get(fa[x]);
}
signed main(){
	init();
	scanf("%lld", &n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&w[i]);
		fa[i]=i;
	}
	for(int i=2;i<=n;i++){
		int u,v,c;
		scanf("%lld%lld%lld",&u,&v,&c);
		insert(u,v,c);
		insert(v,u,c);
	}
	solve(1); 
	sort(ee+1,ee+1+szz,cmp);
	ll ans=0;
	for(int i=1;i<=szz;i++){
		int u=ee[i].u,v=ee[i].v;
		ll c=ee[i].c;
		u=get(u);
		v=get(v);
		if(u==v){
			continue;
		}
		fa[u]=v;
		ans+=c;
	}
	printf("%lld\n",ans);
	return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

// 素因数分解
map<ll, ll> prime_factorize(ll N) {
    map<ll, ll> res;
    for (ll i = 2; i * i <= N; ++i) {
        while (N % i == 0) {
            res[i]++;
            N /= i;
        }
    }
    if (N != 1) res[N] = 1;
    return res;
}

// 約数列挙
vector<ll> divisor(ll N) {
    vector<ll> res;
    for (ll i = 1L; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            ll j = N / i;
            if (j != i)  {
                res.push_back(j);
            }
        }
    }
    sort(res.begin(), res.end());
    return res;
}

bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b){
    return (a.second < b.second); // 昇順
}

vector<ll> vec;

ll num(ll n){
    ll ans = 0;
    for (auto v: vec){if (v >= n - 1){ans++;}}
    return ans;
}

void Main() {
    ll N; cin >> N;
    map<ll, ll> x; // 素因数分解
    rep2(i, 1, N + 1){
        map<ll, ll> tmp = prime_factorize(i);
        for (auto a: tmp){
            if (x.find(a.first) != x.end()){
                x[a.first] += a.second;
            } else {
                x[a.first] = a.second;
            }
        }
    }
    for (auto a: x){vec.push_back(a.second);}
    sort(vec.begin(), vec.end(), greater<ll>());

    // 6 = 2^{1} * 3^{1} だと (1 + 1) * (1 + 1) 個の約数
    // 75個約数があるには
    // (74 + 1)
    // (24 + 1, 2 + 1), (14 + 1, 4 + 1)
    // (4 + 1, 4 + 1, 2 + 1)
    // のどれか

    ll ans = 0;
    ans += num(75);
    ans += num(25) * (num(3) - 1);
    ans += num(15) * (num(5) - 1);
    ans += num(5) * (num(5) - 1) * (num(3) - 2) / 2;
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    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++)
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<int>a(n, 0);
  vector<int>ans;
  rep(i, n) cin >> a.at(i);
  if(n%2==1){
  rep(i, n){
    if(i%2==1){
      ans.push_back(a.at(i));
    }
    else{
      ans.insert(ans.begin(), a.at(i));
    }
    }  
  }
  else{
  rep(i, n){
    if(i%2==0){
      ans.push_back(a.at(i));
    }
    else{
      ans.insert(ans.begin(), a.at(i));
      }
    }  
  }
  rep(i, n) cout << ans.at(i) << " ";
}


Measured memory_bytes: 5112
S = list(input())[::-1]
T = list(input())[::-1]
UNRESTORABLE = True

for i in range(len(S) - len(T) + 1):
    if all((S[i+j] == "?" or S[i+j] == T[j]) for j in range(len(T))):
        UNRESTORABLE = False
        break
if UNRESTORABLE:
    print("UNRESTORABLE")
else:
    ans = []
    for k in range(len(S)):
        if i <= k <= i + len(T) - 1:
            ans.append(T[k-i])
        elif S[k] == '?':
            ans.append('a')
        else:
            ans.append(S[k])

    print(''.join(ans[::-1]))

Measured memory_bytes: 3064
use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let x: Vec<i32> = lines
        .nth(1)
        .unwrap()
        .unwrap()
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();

    let mut ans = 999_999;

    for p in 1..101 {
        let stamina: i32 = x.iter().map(|x_i| (x_i - p).pow(2)).sum();
        if stamina < ans {
            ans = stamina;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
N = int(input())

memo = [0]*100

for n in range(1,N+1):
    s = str(n)
    memo[int(s[0])*10+int(s[-1])] += 1

cnt = 0
for i in range(10):
    for j in range(i,10):
        cnt += memo[i*10+j]*memo[j*10+i]*(1+int(i!=j))

print(cnt)

Measured memory_bytes: 3060
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const long long MOD = 1000000007;

typedef long long ll;

int main(void) {
  int n;
  int a[200];
  cin >> n;
  rep(i, n) cin >> a[i];

  int k = 0, ans = 0;
  while (k < n) {
    int key = k;
    while (k < n && a[key] == a[k]) k++;
    ans += (k - key) / 2;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define PI 3.14159265358979323846

int main(void) {
	int N, K;
	scanf("%d%d", &N, &K);
	int h[100000];
	int count = 0;
	for (int i = 0; i < N; i++) {
		scanf("%d", &h[i]);
		if (h[i] >= K) {
			count++;
		}
	}

	printf("%d", count);



	return 0;
}

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

static const int N = 1000;

void trace(int A[], int n){
  for ( int i = 1; i <= n; i++ ){
    if ( i >1 ) cout << " ";
    cout << A[i];
  }
  cout << endl;
}

main(){
  int n;
  int A[N+1];
  cin >> n;
  for ( int i = 1; i <= n; i++ ) cin >> A[i];

  trace(A, n);
  for ( int j = 2; j <= n; j++ ){
    int key = A[j];
    int i = j - 1;
    while( i > 0 && A[i] > key ){
      A[i+1] = A[i];
      i--;
    }
    A[i+1] = key;

    trace(A, n);
  }
}




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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
constexpr ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

int n, d[55];
void solve() {
    cin >> n;

    rep(i, n) cin >> d[i];

    int ans = 0;
    rep(i, n) rep(j, i) {
        ans += d[i] * d[j];
    }

    cout << ans << endn;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 384
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
#define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
#define rrep(i, n) for (i32 i = (i32)(n) - 1; 0 <= (i32)(i); i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64, i64>;

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    string s;
    cin >> s;
    i64 n = s.size();
    vector<i32> a(n + 1, 0);
    rep(i, n) {
        if (s[i] == '<')a[i + 1] = max(a[i + 1], a[i] + 1);
    }
    rrep(i, n) {
        if (s[i] == '>')a[i] = max(a[i], a[i + 1] + 1);
    }
    i64 ans = 0;
    rep(i, n + 1) {
        ans += a[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 7720
#include<bits/stdc++.h>
using namespace std;
int n;
long long int a[100005];
long long int b[100005];
long long int req;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld %lld",&a[i],&b[i]);
    }
    long long int meghans=0;
    req=0;
    long long int carry=0;
    for(int i=n;i>=1;i--)
    {
        a[i]+=carry;
         req=(a[i]%b[i]);
        if(req==0)
            continue;
        req=b[i]-req;
        carry+=req;
        meghans+=req;

    }
    printf("%lld\n",meghans);
    return 0;
}


Measured memory_bytes: 1920
import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String result = Arrays.stream(sc.nextLine().split(" "))
      .mapToInt(Integer::parseInt)
      .reduce((a, b) -> a * b)
      .getAsInt() % 2 == 0 ? "Even" : "Odd";
    System.out.println(result);
  }
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vector<vector<int>> g(n, vector<int>());
    string s;
    REP(i, n) {
        cin >> s;
        REP(j, n) {
            if (s[j] == '1') {
                g[i].push_back(j);
            }
        }
    }

    int mn = INF;
    int f = -1;
    REP(i, n) {
        if (mn > g[i].size()) {
            mn = g[i].size();
            f = i;
        }
    }
   
    int tans = 0;
    REP(z, n) {
    vector<int> b(n, 0);
    deque<pair<int, int>> q;
    q.emplace_back(z, 1);
    int c, d;
    while (!q.empty()) {
        tie(c, d) = q.front(); q.pop_front();
        if (b[c] == 0) {
            b[c] = d;
        } else if (b[c] + 2 == d || b[c] == d) {
            continue;
        } else {
            cout << -1 << endl;
            return;
        }

        for (int x : g[c]) {
            q.emplace_back(x, d + 1);
        }
    }

    int ans = 0;
    REP(i, n) chmax(ans, b[i]);
    chmax(tans, ans);
    }
    
    cout << tans << endl;
}

Measured memory_bytes: 768
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
char str[4005];
struct tn
{
	int lr,lg,lb;
}a[4005];
int main()
{
	int n;
	cin>>n;
	cin>>str+1;
	ll ans=0;
	int r=0,g=0,b=0;
	for(int i=n;i>=1;i--)
	{
		a[i].lr=r;
		a[i].lb=b;
		a[i].lg=g;
		if(str[i]=='R') r++;
		else if(str[i]=='G') g++;
		else if(str[i]=='B') b++;
	}
	for(int i=1;i<=n;i++)
	{
		if(str[i]=='R') 
		{
			ans+=a[i].lg*a[i].lb;
			int len=n-i;
			for(int j=1;j<=(len+10)/2&&j<=n;j++)
			{
				if(str[i+j]=='G'&&str[i+2*j]=='B')
				ans--;
				if(str[i+j]=='B'&&str[i+2*j]=='G')
				ans--;
			}
		}
		else if(str[i]=='G') 
		{
			ans+=a[i].lr*a[i].lb;
			int len=n-i;
			for(int j=1;j<=(len+10)/2&&j<=n;j++)
			{
				if(str[i+j]=='R'&&str[i+2*j]=='B')
				ans--;
				else if(str[i+j]=='B'&&str[i+2*j]=='R')
				ans--;
			}
		}
		else if(str[i]=='B') 
		{
			ans+=a[i].lg*a[i].lr;
			int len=n-i;
			for(int j=1;j<=(len+10)/2&&j<=n;j++)
			{
				if(str[i+j]=='G'&&str[i+2*j]=='R')
				ans--;
				else if(str[i+j]=='R'&&str[i+2*j]=='G')
				ans--;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
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 n;
int a[100001];

int main() {

  cin >> n;
  rep(i, n) cin >> a[i];

  sort(a, a+n);

  int num;      //現在の値
  int c = 0;    //数字のカウンタ
  int cnt = 0;  //最小値のカウンタ

  a[n] = -1;

  num = a[0];
  ++c;

  for(int i=1; i<n+1; ++i) {
    if(num==a[i]) {
      ++c;
    }else {
      if(num>c) {
        cnt += c;
      }else if(num<c) {
        cnt += c-num;
      }
      num = a[i];
      c = 1;
    }
  }

  cout << cnt << endl;

  return 0;
}


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

int n, d, x, a[100];
int ta = 0;

int main() {
	cin >> n >> d >> x;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		ta += (d - 1) / a[i] + 1;
	}
	cout << x + ta << endl;
	return 0;
}

Measured memory_bytes: 256
#!C:\Users\daichi\Anaconda3/python.exe
# -*- coding: utf-8 -*-

C = input().split()
A = int(C[0])
B = int(C[1])
count=0

for i in range(A,B+1):
    kazu = str(i)
   
    if(kazu[0] == kazu[4]):
       if(kazu[1] == kazu[3]):
           count = count + 1

print(count)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            string s = Console.ReadLine();

            string result = "";
            if (Regex.IsMatch(s, "[A-Z]"))
            {
                result = "A";
            }
            else
            {
                result = "a";
            }
            

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 26884
#include<stdio.h>
int main(void){
	int n, i;
	scanf("%d", &n);
double a[n-1];
  for(i=0; i<n; i++){
    scanf("%lf", &a[i]);
  }
  double m = 1/a[0];
  for(i = 1; i<n; i++){
    m = m+ 1/a[i];
  }
  printf("%lf", 1/m);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int nFiveHundred = sc.nextInt();
        int nHundred = sc.nextInt();
        int nFifty = sc.nextInt();
        int target = sc.nextInt();

        int count = 0;
        for (int i = 0; i <= nFiveHundred; i++) {
            for (int j = 0; j <= nHundred; j++) {
                for (int k = 0; k <= nFifty; k++) {
                    if (500 * i + 100 * j + 50 * k == target) {
                        ++count;
                    }
                }
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <cmath>
#include <limits.h>
#include <utility>
#include <map>
#include <algorithm>
using namespace std;
using P=pair<int,int>;
using ll=long long;
int main(){
    int m,k;
    cin>>m>>k;
    if(pow(2,m)<=k){
        cout<<-1<<endl;
        return 0;
    }
    if(k==0){
        for(int i=0;i<pow(2,m)-1;i++){
            cout<<i<<" "<<i<<" ";
        }
        cout<<pow(2,m)-1<<" "<<pow(2,m)-1<<endl;
        return 0;
    }
    int x=0;
    for(int i=1;i<pow(2,m);i++){
        if(i!=k){
            x^=i;
        }
    }
    if(k==x){
        cout<<k<<" ";
        for(int i=0;i<pow(2,m);i++){
            if(i!=k)cout<<i<<" ";
        }
        cout<<k<<endl;
        for(int i=pow(2,m)-1;i>=1;i--){
            if(i!=k)cout<<i<<" ";
        }
        cout<<0<<endl;
    }else{
        cout<<-1<<endl;
    }
}



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;


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

int main()
{
    int n;
    while(cin>>n,n){
        vector<vector<long long> > t(n,vector<long long>(n+1));
        for(int i=0;i<n;i++){
            for(int j=0;j<n+1;j++) cin>>t[i][j];
        }
        
        vector<long long> dp(1LL<<n,1800000LL);
        dp[0]=0;
        
        //????????????i???????????¢->i?????????bit???1
        for(long long st=0;st<(1LL<<n);st++){
            for(int i=0;i<n;i++){
                if(st&(1<<i)) continue;
                
                //??¨?????????????£????????????§????????????i????????\
                long long cost=t[i][0];
                
                
                for(int j=0;j<n;j++){
                    if(st&(1<<j)){
                        cost=min(cost,t[i][j+1]);
                    }
                }
                dp[st|(1<<i)]=min(dp[st|(1<<i)],dp[st]+cost);
            }
        }
        
        cout<<dp[(1<<n)-1]<<endl;
        
    }
    
    return 0;
}

Measured memory_bytes: 1740
data = []
while True:
  a,b = map(int, input().split())
  if a == 0 and b == 0:
    break
  else:
    ans = 0
    for i in range(1,a-1):
      for j in range(i+1,a+1):
        for k in range(j+1,a+1):
          if i + j + k == b:
            ans += 1
    data.append(ans)

for i in data:
  print(i)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define local
//if you find any bug in my code, please tell me.
int main()
{
#ifdef local
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    int n,i,sum=0,a[100010];
    cin>>n;
    for(i=1; i<=n; i++)
        scanf("%d",&a[i]);
    for(i=2; i<=n; i++)
        sum+=abs(a[i]-a[i-1]);
    sum+=abs(a[1])+abs(a[n]);
    a[0]=a[n+1]=0;
    //cout<<sum<<endl;
    for(i=1; i<=n; i++)
    {
        int t=sum;
        t-=abs(a[i]-a[i-1])+abs(a[i+1]-a[i]);
        t+=abs(a[i+1]-a[i-1]);
        printf("%d\n",t);
    }
    return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
const int N=1e5+10;
char s[N];
int len,res;
int main()
{
	scanf("%s",s);
	len=strlen(s);
	for(int i=0;i<len;++i)
	{
		if(i%2==0 && s[i]=='p')res--;
		if(i%2==1 && s[i]=='g')res++;
	}
	printf("%d\n",res);
	return 0;
} 

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	static char prime[1000002];
	int i,j,k,n;
	for(i=1;i<=1000000;i+=2){
		prime[i]=1;
	}
	prime[1]=0;
	prime[2]=1;
	for(i=1;i<=1000;i+=2){
		if(prime[i]==1){
			for(j=3;i*j<=1000000;j+=2){
				prime[i*j]=0;
			}
		}
	}
	while(1){k=0;
		scanf("%d",&n);
		if(n==0){
			break;
		}
		for(i=2;i<=n/2;i++){
			if(prime[i]&&prime[n-i]){
				k++;
			}
		}

				printf("%d\n",k);
	}
				return 0;
	}

Measured memory_bytes: 1576
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            var line1 = Console.ReadLine();
            var sum = 0;
            for (int i = 0; i < line1.Length; i++)
            {
                if (line1[i] == '+')
                {
                    sum++;
                }
                else
                {
                    sum--;
                }
            }
            Console.WriteLine(sum);
            
            Console.ReadLine();
        }
    }
}


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

using namespace std;
int ans(string x){
  int a = 0;
  int b = 0;
  int n = x.size();
  for(int i = 0;i<n;i++){
    if(i%2==0){
      if(x.at(i)=='0'){
        a++;
      }
      else{
        b++;
      }
    }
    if(i%2==1){
      if(x.at(i)=='0'){
        b++;
      }
      else{
        a++;
      }
    }
  }
  int k = max(a,b);
  return n-k;
}
  
  
  
  
  
  
int main(){
string S;
  cin>>S;
  cout<<ans(S);
}

Measured memory_bytes: 512
#include<set>
#include<iostream>

using namespace std;

int main() {
    int T;
    cin >> T;
    set<int> s;
    while (T--) {
        int a;
        cin >> a;
        if (a == 0) {
            int t;
            cin >> t;
            s.insert(t);
            cout << s.size() << endl;
        } else if (a == 1) {
            int t;
            cin >> t;
            cout << (s.find(t) != s.end()) << endl;
        } else if (a == 2) {
            int t;
            cin >> t;
            s.erase(t);
        } else {
            int l, r;
            cin >> l >> r;
            auto it = s.lower_bound(l);
            auto it1 = s.upper_bound(r);
            for (; it != it1; it++) cout << *it << endl;
        }
    }
    return 0;
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    int a,b,c;
    cin >> a >> b >> c;

    int ans = 0;
    if(a + b >= c - 1) {
        cout << b + c << endl;
    } else {
        cout << (b + a + 1) + b << endl;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main()
{
    string s;
    int minDiff = 753;

    cin >> s;

    for(int i = 1; i < s.size() - 1; ++i)
    {
        int num = atoi((string("") + s[i - 1] + s[i] + s[i + 1]).c_str());

        minDiff = min(minDiff, abs(num - 753));
    }

    cout << minDiff << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt(), A = sc.nextInt();
		if(H%A == 0) {
			System.out.println(H/A);
		}else {
			System.out.println((H/A)+1);
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;
char a[2][3];
int main(){
    for(int i=0;i<=1;i++){
    	for(int j=0;j<=2;j++){
    		cin>>a[i][j];
		}
	}
	if(a[0][1]==a[1][1]&&a[0][2]==a[1][0]&&a[0][0]==a[1][2])cout<<"YES";
	else cout<<"NO";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define for(i,init,n) for(int i=init;i<=n;i++)
int ABS(int a){return max(a,-a);}
ll ABS(ll a){return max(a,-a);}
double ABS(double a){return max(a,-a);}

const int N = 100005;
int arr[N];
int dp[N];

int main()
{
  /*#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif*/

  ios::sync_with_stdio(0);
  cin.tie(0);

  int n;
  cin>>n;

  for(i,1,n)
    cin>>arr[i];

  dp[1]=0;
  dp[2]=ABS(arr[1]-arr[2]);

  for(i,3,n)
    dp[i] = min(dp[i-1]+ABS(arr[i]-arr[i-1]),dp[i-2]+ABS(arr[i]-arr[i-2]));

  cout<<dp[n];
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
struct cake{ll a,b,c;};
const ll inf = 1001001001001001001;
int main(){
  ll N,M,i,j,k,l,ans = -inf;scanf("%lld%lld",&N,&M);
  cake C[N];
  for(i=0;i<N;i++) scanf("%lld%lld%lld",&C[i].a,&C[i].b,&C[i].c);
  for(i=0;i<2;i++){
    for(j=0;j<2;j++){
      for(k=0;k<2;k++){
        ll V[N] = {};
        for(l=0;l<N;l++){
          V[l] += (i ? C[l].a:-C[l].a);
          V[l] += (j ? C[l].b:-C[l].b);
          V[l] += (k ? C[l].c:-C[l].c);
        }
        sort(V,V+N,greater<ll>());
        ans = max(ans,accumulate(V,V+M,0LL));
      }
    }
  }
  printf("%lld\n",ans);
}

Measured memory_bytes: 3856
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
int vis[2*Max]={0};
int main()
{
    LL n,k;
    scanf("%lld%lld",&n,&k);
    LL ans=0;
    if(k%2==1)
        ans=(n/k)*(n/k)*(n/k);
    else{
        LL t1=n/k;
        LL t2=t1;
        if(n%k>=k/2){
            t2++;
        }
        ans=t1*t1*t1+t2*t2*t2;
    }
    printf("%lld\n",ans);
    return 0;
}


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

template <typename T>
void logVector(vector<T> data)
{
    cout << endl
         << "vector: " << typeid(T).name() << endl;
    rep(i, data.size())
    {
        cout << i << ": " << data[i] << endl;
    }
    cout << endl;
}

int main()
{
    ll n, k, c;
    string s;

    cin >> n >> k >> c;
    cin >> s;

    vector<int> l(k), r(k);
    int i = 0;
    while (s[i] == 'x')
        i++;
    l[0] = i;
    i = n - 1;
    while (s[i] == 'x')
        i--;
    r[k - 1] = i;

    rep(j, k - 1)
    {
        i = l[j] + c + 1;
        while (s[i] == 'x')
            i++;
        l[j + 1] = i;
        i = r[k - 1 - j] - c - 1;
        while (s[i] == 'x')
            i--;
        r[k - 2 - j] = i;
    }

    // logVector<int>(l);
    // logVector<int>(r);

    rep(j, k)
    {
        if (l[j] == r[j])
        {
            cout << (l[j] + 1) << endl;
        }
    }
}

Measured memory_bytes: 3332
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a,b;
cin>>a>>b;
int n=a.size();
int n1=b.size();
if(n!=n1){
	cout<<"0";
}
int ans=0;
for(int i=0; i<=n; i++)
{
	if(a[i]!=b[i])
	++ans;
}
cout<<ans<<"\n";
}

Measured memory_bytes: 3840
#include <stdio.h>

void bsort(int a[],int b[],int lim)
{
	int temp = 0;
	int n;
	int m;


	for( n = 0 ; n < lim - 1 ; n++){
		for( m = 0 ; m < lim - 1 - n ; m++){

		if(a[m] > a[m+1])
		{
			temp = a[m+1];
			a[m+1] = a[m];
			a[m] = temp;
			temp = b[m+1];
			b[m+1] = b[m];
			b[m] = temp;
		}
		}

	}
}
			



int main(void)
{
	int n = 1;
	int tr[25] = {0};
	int br[25] = {0};
	
	int i;

	int gettr = 0;
	
	int out[10000] = {0};
	int round = 0;

	while(n){

		scanf("%d",&n);

		for( i = 0 ; i < n ; i++){
			scanf("%d",&tr[i]);
			scanf("%d",&br[i]);
		}

		bsort(br, tr, n);

		for( i = 0 ; i < n ; i++){
			gettr += tr[i];
			
			if( gettr > br[i]){
				out[round] = 2;
				break;
			}
		}

		if(out[round] != 2)
		out[round] = 1;

		round++;
		gettr = 0;
		
	}

	

	for(i = 0; i < round - 1 ; i++ )
	{
		if(out[i] == 1)
			puts("Yes");
		else
			puts("No");
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstring>

const int mod = 10000;

int N, K;
int plan[100];
int dp[100][3][2];

int main()
{
	std::cin >> N >> K;
	
	memset( plan, -1, sizeof( plan ) );

	for( int i = 0; i != K; ++i )
	{
		int A, B;
		std::cin >> A >> B;

		plan[A-1] = B - 1;
	}

	if( plan[0] != -1 )
		dp[0][plan[0]][0] = 1;
	else
		for( int i = 0; i != 3; ++i )
			dp[0][i][0] = 1;

	for( int i = 0; i != N - 1; ++i )
	{
		if( plan[i+1] != -1 )
		{
			for( int j = 0; j != 3; ++j )
				if( j != plan[i+1] )
					dp[i+1][plan[i+1]][0] = ( dp[i+1][plan[i+1]][0] + dp[i][j][0] + dp[i][j][1] ) % mod;
			
			dp[i+1][plan[i+1]][1] = ( dp[i+1][plan[i+1]][1] + dp[i][plan[i+1]][0] ) % mod;
		}
		else
		{
			for( int j = 0; j != 3; ++j )
			{
				for( int k = 0; k != 3; ++k )
					if( j != k )
						dp[i+1][j][0] = ( dp[i+1][j][0] + dp[i][k][0] + dp[i][k][1] ) % mod;

				dp[i+1][j][1] = ( dp[i+1][j][1] + dp[i][j][0] ) % mod;
			}
		}
	}

	int ans = 0;
	for( int i = 0; i != 3; ++i )
		for( int j = 0; j != 2; ++j )
			ans = ( ans + dp[N-1][i][j] ) % mod;

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

	return 0;
}

Measured memory_bytes: 1164
N = int(input())
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    return divisors
 
cnt = 0  
for n in range(1,N+1):
    if len(make_divisors(n)) == 8 and n%2==1:
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

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

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

INF=Float::INFINITY

a,b=get_f
a=a.to_i
b=(b*1000).to_i
puts ((a*b)/1000).floor

Measured memory_bytes: 14292
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
    int n,k,x,y;
    cin >> n >> k >> x >> y;
    int ans=0;
    if(n>k){
        ans+=k*x;
        ans+=y*(n-k);
    }
    else ans+=n*x;
    cout << ans << endl;
}


Measured memory_bytes: 256
Scanf.scanf "%d %s" (fun n s ->
    let e = Array.make n 0 in
    let w = Array.make n 0 in
    if s.[0] = 'E' then e.(0) <- 1 else w.(0) <- 1;
    for j = 1 to n - 1 do
        if s.[j] = 'E' then (e.(j) <- e.(j - 1) + 1; w.(j) <- w.(j - 1))
                       else (w.(j) <- w.(j - 1) + 1; e.(j) <- e.(j - 1))
    done;
    let rec loop i acc =
        if i = n then acc else (
            let q =
                if i = 0     then e.(n - 1) - e.(i) else
                if i = n - 1 then w.(i - 1)         else
                                  e.(n - 1) - e.(i) + w.(i - 1)
            in
            let acc = min acc q in
            loop (i + 1) acc

        )
    in
    loop 0 max_int |> Printf.printf "%d\n"
)

Measured memory_bytes: 8320
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll v;
	while(cin>>v) {
		map<ll, ll> h;
		h[v]++;
		REP(i, 5) {
			cin>>v;
			h[v]++;
		}
		string ans = "YES";
		for(auto kv : h) if(kv.second>=3) ans="NO";
		cout<<ans<<endl;
	}
	
	return 0;
}


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

int H, W;
int field[110][110];

void display() {
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cout << field[i][j] << " ";
    }
    cout << endl;
  }
}

int main() {
  cin >> H >> W;
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];

  // 蛇のように塗っていけばOK
  int pos = 0;
  int idx = 0;
  for (int i = 0; i < H; ) {
    if (i & 1) {
      for (int j = pos; j >= 0; j--) {
        field[i][j] = idx + 1;
        a[idx]--;
        pos = j - 1;
        if (a[idx] == 0) {
          idx++;
          if (j == 0) {
            pos = j;
            i++;
          }
          break;
        }
        if (j == 0) {
          pos = j;
          i++;
        }
      }
    } else {
      for (int j = pos; j < W; j++) {
        field[i][j] = idx + 1;
        a[idx]--;
        pos = j + 1;
        if (a[idx] == 0) {
          idx++;
          if (j == W - 1) {
            pos = j;
            i++;
          }
          break;
        }
        if (j == W - 1) {
          pos = j;
          i++;
        }
      }
    }
  }

  // 解答
  display();

  return 0;
}


Measured memory_bytes: 384
#coding: utf-8

s = input()
x = int(input())

single = []
for i in range(len(s)):
    single.append(s[i])

count = 0
result = []
ssingle = sorted(list(set(single)))
for i in range(len(ssingle)):
    for j in range(len(s)):
        if s[j] == ssingle[i]:
            for k in range(1,x+1):
                if k > len(s):
                    break
                if s[j:j+k] not in result:
                    result.append(s[j:j+k])
                result = sorted(result)
                if len(result) > len(s):
                    break
        if len(result) > len(s):
            break
    if len(result) > len(s):
        break
print(result[x-1])


Measured memory_bytes: 3440
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int result = getPrize(x) + getPrize(y);
        if (x == 1 && y == 1) {
            result += 400000;
        }

        // 出力
        System.out.println(result);
    }

    public static int getPrize(int rank) {
        if (rank == 1) {
            return 300000;
        } else if (rank == 2) {
            return 200000;
        } else if (rank == 3) {
            return 100000;
        }
        return 0;
    }
}


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

const int N = 1010;

typedef pair<int, int> P;

#define fir first
#define sec second

vector<P> G[N];

bool vis[N]; int ct[N][N], wkr[N];

int rt, n, col; 

void dfs(int u, int type) {
    if (!type) wkr[u] = col;
    else if (wkr[u] != col) ct[rt][u] |= 1;
    vis[u] = 1;
    for (auto v : G[u]) if (!vis[v.sec]) dfs(v.sec, type);
}

inline void clr() {
    for (int i = 1; i <= n; i++) vis[i] = 0;
}

inline void solve(int u) {
    rt = u, clr(), vis[u] = 1;
    for (auto v : G[u]) if (!vis[v.sec]) dfs(col = v.sec, 0);
    clr(), vis[u] = 1;
    for (int i = (int)G[u].size() - 1; i >= 0; i--) if (!vis[G[u][i].sec]) dfs(col = G[u][i].sec, 1);
    for (int i = 1; i <= n; i++) if (vis[i]) ct[i][u] |= 2;
}

int ans[N * 200];

int main() {
    int m; scanf("%d%d", &n, &m);
    for (int i = 1, a, b; i <= m; i++) scanf("%d%d", &a, &b), G[a].push_back(P(i, b));
    for (int i = 1; i <= n; i++) solve(i);
    for (int i = 1; i <= n; i++) for (auto v : G[i]) 
        if (ct[i][v.sec] != 0 && ct[i][v.sec] != 3) ans[v.fir] = 1;
    for (int i = 1; i <= m; i++) puts(ans[i] ? "diff" : "same");

}

Measured memory_bytes: 11584