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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << H*W - h*W-w*H +h*w;
  return 0;
}


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

using namespace std;

constexpr int MAXN = 100;

int X[MAXN + 2];

int main() {
	int N;
	cin >> N;
	for(int i = 0; i < N; i++)
		cin >> X[i];
	int best = INT_MAX, p = 0;
	for(int i = 1; i <= 100; i++) {
		int cost = 0;
		for(int j = 0; j < N; j++) {
			int d = X[j] - i;
			cost += d * d;
		}
		if(best > cost) {
			best = cost;
			p = i;
		}
	}
	cout << best << '\n';
}



Measured memory_bytes: 256
#include <stdio.h>

#define NMAX 100000

int partition(int *,int,int);

int main(void){

  int n,i,p;
  int A[NMAX];

  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&A[i]);
  }
  p = partition(A,0,n-1);

  for(i = 0;i < p;i++){
    printf("%d ",A[i]);
  }
  printf("[%d] ",A[p]);
  for(i = p + 1;i < n;i++){
    if(i == n - 1){
      printf("%d\n",A[i]);
    }else{
      printf("%d ",A[i]);
    }
  }

  return 0;
}

int partition(int *A,int p,int r){

  int x,i,j,temp;
  x = A[r];
  i = p-1;

  for(j = p;j < r;j++){
    if(A[j] <= x){
      i++;
      temp = A[i];
      A[i] = A[j];
      A[j] = temp;
    }
  }
  temp = A[i+1];
  A[i+1] = A[r];
  A[r] = temp;

  return i+1;
  
}



Measured memory_bytes: 2092
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll n;
	cin >> n;
	string s;
	cin >> s;
	for (ll i = 0; i < s.size(); i++) {
		if ((char)(s[i]+n)>'Z') {
			cout <<( char)('A'+s[i]+n-'Z'-1);
		}
		else {
			cout << (char)(s[i] + n);
		}
	}
	cout << endl;

}


Measured memory_bytes: 256
N, M = list(map(int, input().split()))

edges = [[] for _ in range(N+1)]
for _ in range(M):
    L, R, D = list(map(int, input().split()))
    edges[L].append((R, D))
    edges[R].append((L,-D))

x = [None]*(N+1)
for i in range(1,N+1):
    if x[i] is not None: continue
    queue = [i]
    x[i] = 0
    minx = maxx = 0
    while len(queue)>0:
        queue_new = []
        for q in queue:
            for r, d in edges[q]:
                dist = x[q] + d
                if x[r]==None:
                    x[r] = dist
                    queue_new.append(r)
                elif x[r]!=dist:
                    print('No')
                    exit()
                    
        queue = queue_new

print('Yes')

Measured memory_bytes: 69268
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

class UnionFind {
public:
	// parents[i] >= 0 なら i の親
	// parents[i] < 0 で、根。abs(parents[i])がその木に属する頂点数
	vector<int> parents;
	int n_root;

public:
	UnionFind();
	UnionFind(int n) {
		parents.assign(n, -1);
		n_root = n;
	}
	~UnionFind() {
		parents.clear();
	};

	int find(int x) {
		if (parents[x] < 0) {
			return x;
		} else {
			return parents[x] = find(parents[x]);
		}
	}

	void unite(int x, int y) {
		x = find(x);
		y = find(y);

		if (x == y) {
			return;
		}

		if (size(x) < size(y)) {
			swap(x, y);
		}

		parents[x] += parents[y];
		parents[y] = x;
		n_root--;
		return ;
	}

	bool same(int x, int y) {
		return find(x) == find(y);
	}

	// xが属する集団のサイズ
	int size(int x) {
		return -parents[find(x)];
	}

	// いくつの集団があるか
	int get_n_root() {
		return n_root;
	}
};

int main() {
	int n, m, a, b;
	cin >> n >> m;

	UnionFind uf(n);
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		uf.unite(a-1, b-1);
	}

	int ans = 0;
	for (auto x: uf.parents) {
		if (x < 0) {
			ans = max(ans, abs(x));
		}
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3656
#lang racket

(define (read-int n)
  (if (zero? n)
      null
      (cons (read) (read-int (- n 1)))))

(define (sum items)
  (if (null? items)
      0
      (+ (car items) (sum (cdr items)))))

(define (solve N A)
  (let ([A-sum (sum A)])
    (if (<= A-sum N)
        (- N A-sum)
        -1)))

(let* ([N (read)]
       [M (read)]
       [A (read-int M)])
  (display (solve N A)))
  


Measured memory_bytes: 98728
#include<iostream>
#include<math.h>
#include<string.h>
using namespace std;

int seiyaku_check(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	int a,b,c;
	cin >> a >> b;
	seiyaku_check(a,3,20);
	seiyaku_check(b,3,20);
	c=0;
	
	if(a>=b){
		c=a;
		a -= 1;
	}else{
		c = b;
		b -= 1;
	}
	
	if(a>=b){
		c+=a;
	}else{
		c += b;
	}
	
	cout << c << endl;
	
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;
  std::cin >> s;
int cur = 0;  
  for(auto itr : s){
	if(itr == '+') cur++;
    else cur--;
  }
  
  cout << cur << endl;
 return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define ALL(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef LL ut;
typedef pair<ut,ut> pr;
typedef vector<ut> VI;
typedef vector<pr> Vpr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
const int SIZE=3*1e5;
const ut INF=1LL<<60;
int main(){
	LL n,d;
	cin >> n >> d;
	LL clerk=n-d;
	LL getter=min(d,2LL);
	LL ans=clerk*(clerk-1)/2+clerk*getter+(d-getter);
	cout << ans << endl;
	return 0;
}

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

int N;
int acc1[110], acc2[110];

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N;
    rep(i, N) {
        int A; cin >> A;
        acc1[i+1] = acc1[i]+A;
    }
    rep(i, N) {
        int A; cin >> A;
        acc2[i+1] = acc2[i]+A;
    }
    int ans = 0;
    rep(i, N) ans = max(ans, acc1[i+1]+acc2[N]-acc2[i]);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
#include<stack>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	int a,b,c,d,k;
	cin>>a>>b>>c>>d>>k;
	if(d<b)
	{
		d+=60;
		c--;
	}
	int l=(c-a)*60+d-b;
	cout<<l-k;
	return 0;
}


Measured memory_bytes: 3592
package main

import (
	"fmt"
	"os"
)

func main() {
	var k int
	fmt.Scan(&k)

	cnt := 0
	var rec func(x int, ns []int)
	rec = func(x int, ns []int) {
		for i := 0; i < len(ns)-1; i++ {
			if abs(ns[i]-ns[i+1]) > 1 {
				return
			}
		}

		if x == 0 {
			cnt++
			if cnt == k {
				for i := 0; i < len(ns); i++ {
					fmt.Print(ns[i])
				}
				fmt.Println()
				os.Exit(0)
			}
			return
		}

		for i := 0; i < 10; i++ {
			if len(ns) == 0 && i == 0 {
				continue
			}
			rec(x-1, append(ns, i))
		}
	}

	for i := 1; ; i++ {
		rec(i, []int{})
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 6528
import sys
MAX_INT = int(10e9)
MIN_NUM = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()

n = N-1
ans = n*(n+1)//2
print(ans)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
#define MOD 1000000007
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

// cout << fixed << setprecision(12)

int main(){
  
  lint D; cin >> D;
  vi c(26); // contest 0-25
  for(lint i=0; i<26; i++) cin >> c[i];
  vvi s(D+1, vi(26)); // day 0-D
  for(lint d=1; d<=D; d++){
    for(lint j=0; j<26; j++){
      cin >> s[d][j];
    }
  }
  /*
  vi t(D+1); // day 0-D
  
  for(lint d=1; d<=D; d++){
    cin >> t[d];
    t[d]--;
  }
  */
  
  vi last(26,0);
  
  // lint ans = 0;
  
  for(lint d=1; d<=D; d++){
    vi diff(26);
    
    for(lint i=0; i<26; i++){ // if contest i (0-25)
      // ans += s[d][t[d]];
      lint plus = s[d][i];
    
      // last[t[d]] = d;
      lint oldlast = last[i];
      last[i] = d;
    
      lint minus = 0;
    
      for(lint j=0; j<26; j++){
        // ans -= c[j] * (d - last[j]);
        minus += c[j] * (d - last[j]);
      }
      
      last[i] = oldlast;
      diff[i] = plus - minus;
    }
    
    vi oldiff = diff;
    sort(ALL(diff));
    lint t = -1;
    for(lint j=0; j<26; j++){
      if(oldiff[j] == diff[25]) t = j;
    }
    cout << t+1 << endl;
    last[t] = d;
    
  }
  /*
  sort(ALL(c));
  lint tmp = 18; // delete suru kosuu
  for(lint j=0; j<tmp; j++) c.pop_back();
          
  for(lint d=1; d<=D; d++){
    cout << c[d%(26-tmp)] << endl;
  }
  */
}
      
      
    
  
  
  
  

Measured memory_bytes: 3684
#include <iostream>
#include <string>

int main(){
   std::string A, B;
   std::cin >> A >> B;
   if (A.size() > B.size()){
      std::cout << "GREATER" << std::endl;
      return 0;
   } else if (A.size() < B.size()){
      std::cout << "LESS" << std::endl;
      return 0;
   } else{
      for (int i=0; i<A.size(); i++){
         if (A.at(i) > B.at(i)){
            std::cout << "GREATER" << std::endl;
            return 0;
         } else if (A.at(i) < B.at(i)){
            std::cout << "LESS" << std::endl;
            return 0;
         }
      }
   }
   std::cout << "EQUAL" << std::endl;

}



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

int main(void) {
    int N;
    string s;
    cin >> N >> s;

    int unique = 1;
    for (int i = 1; i < N; i++) {
        if (s[i] != s[i-1]) unique++;
    }

    cout << unique << "\n";
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
    cin>>a>>b>>c;
    if((a==b && b!=c) || (a==c && a!=b) || (b==c && a!=b))
        cout<<"Yes";
    else cout<<"No";
    return 0;
}


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

int main(){
  long long int n;
  cin >> n;
  long long int mod=1000000007;
  vector<long long int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  long long int x=0,ans=0;
  for(int j=1;j<n;j++){
    x+=a.at(j-1);
    x%=mod;
    ans+=a.at(j)*x;
    ans%=mod;
  }
  cout << ans << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto& i : v) cin >> i;

    int ans = -1;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            int x = v[i] * v[j];
            int k = x % 10; k++;
            bool flag = true;
            while (x) {
                if ((x % 10) + 1 != k) flag = false;
                k = x % 10;
                x /= 10;
            }
            if (flag) ans = max(ans, v[i]*v[j]);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3084
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
const ll INF = 1e18;
using P = pair<ll,ll>;
#define chmin(x,y) x = min(x,y)
ll dp[20][20];
vector<ll> calc(vector<P> &a){
    ll n = a.size();
    sort(a.begin(),a.end());
    rep(i,n + 1){
        rep(j,n + 1){
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;
    rep(l,n){
        for(int r = l + 1; r <= n; r++){
            {
                ll now = INF;
                for(int k = l; k < r; k++){
                    ll s = 0;
                    for(int i = l; i < r; i++){
                        s += abs(a[i].first - a[k].first) * a[i].second;
                    }
                    chmin(now,s);
                }
                rep(j,n) chmin(dp[r][j + 1],dp[l][j] + now);
            }
            {
                ll now = 0;
                    for(int i = l; i < r; i++) {
                        now += abs(a[i].first) * (a[i].second);
                    }
                rep(j,n + 1) chmin(dp[r][j],dp[l][j] + now);
            }
        }
    }
    vector<ll> res(n + 1,INF);
    rep(j,n + 1) res[j] = dp[n][j];
    return res;
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n;
cin >> n;
vector<ll> x(n),y(n),p(n);
rep(i,n) cin >> x[i] >> y[i] >> p[i];
vector<ll> ans(n + 1,INF);
rep(s,1 << n) { //x,yでの全探索決め打ちはビット演算を使う
    vector<P> ax, ay;
    rep(i, n) {
        if (s >> i & 1) {
            ax.emplace_back(x[i], p[i]);
        } else {
            ay.emplace_back(y[i], p[i]);
        }
    }
    vector<ll> dx = calc(ax);
    vector<ll> dy = calc(ay);
    rep(i, dx.size()) {
        rep(j, dy.size()) {
            ans[i + j] = min(ans[i + j], dx[i] + dy[j]);
        }
    }
}
    rep(i,n + 1){
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 3604
from collections import deque

s = input()
q = int(input())

dq = deque(s)
rev = False
fcond = {"1": True, "2": False}
rcond = {True: False, False: True}
for i in range(q):
    t = input()
    if t.startswith("1"):
        rev = rcond[rev]
    elif t.startswith("2"):
        _, f, c = t.split()
        if fcond[f] is not rev:
            dq.appendleft(c)
        else:
            dq.append(c)
if rev:
    print("".join(reversed(dq)))
else:
    print("".join(dq))

Measured memory_bytes: 8564
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        a: i64,
        b: i64,
        c: i64,
        v: [i64; n]
    }
    let ans = solve(a, b, c, n, &v);
    println!("{}", ans);
}

fn solve(a: i64, b: i64, c: i64, n: usize, v: &Vec<i64>) -> i64 {
    let mut ans = i64::max_value();
    for i in 1..1 << 2 * n {
        let mut m = 0;
        let mut x = 0;
        let mut y = 0;
        let mut z = 0;
        for j in 0..n {
            let k = (i >> 2 * j) & 3;
            if k == 1 {
                m += 1;
                x += v[j];
            } else if k == 2 {
                m += 1;
                y += v[j];
            } else if k == 3 {
                m += 1;
                z += v[j];
            }
        }
        if x == 0 || y == 0 || z == 0 {
            continue;
        }
        let mp = (a - x).abs() + (b - y).abs() + (c - z).abs() + 10 * m - 30;
        ans = std::cmp::min(ans, mp);
    }
    ans
}


Measured memory_bytes: 4352
let h = ref 0
let n, k, s, t, d = Scanf.scanf " %d %d %s" @@ fun n k s -> String.iteri (fun i c -> if i > 0 && s.[i - 1] = s.[i] then incr h) s; n, k, s, min k @@ (n - 1 - !h) / 2, n - 1 - !h
let _ = Printf.printf "%d\n" @@ if k > t && d mod 2 = 1 then n - 1 else !h + 2 * t

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0); cin.tie(0)
#define int int64_t
#define ii pair<int, int>
#define endl '\n'
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define vvii vector<vii>
#define F first
#define S second
#define pb push_back
#define FOR(i,l,r) for(int i=l; i<r; ++i)
#define ROF(i,r,l) for(int i=r; i>l; --i)
#define all(x) x.begin(), x.end()
#define amin(a,b) a = min(a,b)
#define amax(a,b) a = max(a,b)
#define test int t; cin >> t; while(t--) solve();

using namespace std;
typedef long long ll;

const int MAXN = 1e5+2;
const int MAXINT = 2147483098;
const int MAXLL = 9223372036854775258LL;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;








int32_t main()
{
    //freopen("holiday.in", "r", stdin);
    fast;
    //test;

    double d,t,s;
    cin >> d >> t >> s;
    if (d/s<=t) cout << "Yes";
    else cout << "No";





   return 0;
}


Measured memory_bytes: 3740
from collections import Counter

n = int(input())
wordlist = []

for i in range(n):
    word = input()
    wordlist.append(word)

c = Counter(wordlist[0])

ans_list = [0] * 26

for i, j in c.items():
    ans = 100
    if n == 1:
        ans = j
    for k in range(1,n):
        count = 0
        for l in range(len(wordlist[k])):
            if wordlist[k][l] == i:
                count += 1
        if count > j:
            count = j
        if count < ans:
            ans = count
    index = ord(i) - 97
    ans_list[index] = ans

for i in range(26):
    moji = chr(i+97)
    print(moji*ans_list[i], end='')

Measured memory_bytes: 3436
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b - a == c - b)cout << "YES";
	else cout << "NO";

	return 0;
}




Measured memory_bytes: 256
import sys

input = sys.stdin.readline
N = int(input())
Ss = [''.join(sorted(input().rstrip())) for _ in range(N)]

import collections

Co = collections.Counter(Ss)
Su = 0
for _, c in Co.most_common():
    if c < 2:
        break
    Su += (c - 1) * c // 2

print(Su)

Measured memory_bytes: 72156
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    if(a<b) {
      System.out.println("a < b");
    } else if(a>b) {
      System.out.println("a > b");
    } else {
      System.out.println("a == b");
    }
  }
}


Measured memory_bytes: 26212
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const double INF = 1e18;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

bool eq(double x, double y){ return abs(x - y) < EPS; }
struct Point{
  int x, y;
  Point() {}
  Point(double x, double y) : x(x), y(y) {}
  Point operator+(const Point& b) const { return Point(x + b.x, y + b.y); }
  Point operator-(const Point& b) const { return Point(x - b.x, y - b.y); }
  Point operator*(const double b) const { return Point(x * b, y * b); }
  Point operator*(const Point& b) const { return Point(x * b.x - y * b.y, x * b.y + y * b.x); }
  Point operator/(const double b) const { return Point(x / b, y / b); }
  bool operator< (const Point& b) const { return x != b.x ? x < b.x : y < b.y; }
  bool operator==(const Point& b) const { return eq(x, b.x) && eq(y, b.y); }
  int norm(){ return x * x + y * y; }
  double arg(){ return atan2(x, y); }
  double abs(){ return sqrt(norm()); }
  Point rotate(double theta){ return Point(cos(theta) * x - sin(theta) * y, sin(theta) * x + cos(theta) * y); }
  Point rotate90(){ return Point(-y, x); }
};

bool compare_y(const Point& a, const Point& b){
  return a.y < b.y;
}

int closest_pair(vector<Point>::iterator begin, vector<Point>::iterator end){
  int N = end - begin;
  if(N == 1) return 1000000000;
  int M = N / 2;
  int mx = (begin + M)->x; //中心のx座標
  int d = min(closest_pair(begin, begin + M), closest_pair(begin + M, end));
  inplace_merge(begin, begin + M, end, compare_y); //y座標でソート

  vector< vector<Point>::iterator > b;
  for(vector<Point>::iterator it1 = begin; it1 != end; it1++){
    if(abs(it1->x - mx) >= d) continue;
    for(auto it2 = b.rbegin(); it2 != b.rend(); it2++){
      int dy = it1->y - (*it2)->y;
      if(dy >= d) break;
      int dx = it1->x - (*it2)->x;
      d = min(d, dx*dx + dy*dy);
    }
    b.push_back(it1);
  }

  return d;
}

int main(){
  int N;
  while(cin >> N && N){
    vector<Point> ps(N);
    REP(i, N){
      scanf("%d %d", &ps[i].x, &ps[i].y);
    }
    sort(ps.begin(), ps.end());
    cout << closest_pair(ps.begin(), ps.end()) << endl;
  }
  return 0;
}

Measured memory_bytes: 10748
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

//scanf("%d",&x);
//printf("%d",x);
//for(i=0;i<N;i++){  }
//if( == ){  }else{  }
//while( ){  }

int main()
{
	int i;
	char S[3];
	char T[3];
	int Ans = 0;


	scanf("%s", &S);
	scanf("%s", &T);

	for (i = 0; i < 3; i++) {
	     if (S[i] == T[i]) 
		Ans++;
	     
    }
	printf("%d",Ans);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a;
    cin >> a;
    for (int i = 1; i < 10; ++i)
        for (int j = 1; j < 10; ++j)
            if (i * j == a)
            {
                cout << "Yes";
                return 0;
            }
    cout << "No";
}


Measured memory_bytes: 256
X, Y = map(int, input().split())
      
C=2
T=4
B=(4*X)
A=Y%2
end=False
tiny=False
D=(Y/2)

if D<X:
      print("No")
      tiny=True
if Y > B and tiny == False:
      print("No")
      end=True
      
if end==False and A == 0 and tiny == False:
      print("Yes")
if end==False and A !=0 and tiny == False:
      print("No")

Measured memory_bytes: 9176
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

min_diff = 10**8
ans = -1

for i in range(len(h)):
    temp = t - h[i] * 0.006
    if abs(temp - a) < min_diff:
        min_diff = abs(temp - a)
        ans = i + 1

print(ans)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N, ans = 0; cin >> N;
    rrep (i, 1, N) {
        if (to_string(i).size() % 2 != 0) ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
// #include <vector>
// #include <cmath>
using namespace std;
// using ll = long long;

int main(int argc, char const *argv[]) {
    int N,C,a,ans = 1<<30;
    cin >> N >> C;
    int D[30][30];
    int color[3][30] = {};
    for (size_t i = 0; i < C; ++i) for (size_t j = 0; j < C; ++j) cin >> D[i][j];
    for (size_t i = 0; i < N; ++i) for (size_t j = 0; j < N; ++j) {
        cin >> a;
        color[(i+j)%3][a-1]++;
    }

    for (size_t i = 0; i < C; ++i) {
        for (size_t j = 0; j < C; ++j) {
            if (i == j) continue;
            for (size_t k = 0; k < C; ++k) {
                if (i == k  ||  j == k) continue;
                int rec = 0;
                for (size_t l = 0; l < C; ++l) {
                    rec += D[l][i]*color[0][l] + D[l][j]*color[1][l] + D[l][k]*color[2][l];
                }
                if (rec < ans) ans = rec;
            }
        }
    }
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int W = Integer.parseInt(sc.next());
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		System.out.println(Math.max(Math.abs(b-a)-W, 0));
	}
}

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

const int MAXR = 20;
const int BIT = 1<<MAXR;
const int mod = 100000;
const char C[] = {'J', 'O', 'I'};
int H, W;
char G[MAXR][MAXR];
int dp[2][2][BIT];


int main() {
  while(cin >> H >> W) {
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
	cin >> G[i][j];
      }
    }

    int B = (1<<W);
    fill(dp[0][0], dp[2][0], 0);
    dp[0][0][0] = 1;
    for(int i = 0; i < H*W; ++i) {
      int p = i%2;
      int q = 1-p;
      int x = i % W;
      int y = i / W;
      for(int j = 0; j < 2; ++j)
	for(int k = 0; k < B; ++k)
	  dp[q][j][k] = 0;

      for(int j = 0; j < 2; ++j) {
	for(int k = 0; k < B; ++k) {
	  if(dp[p][j][k] == 0) continue;
	  for(int l = 0; l < 3; ++l) {
	    if(G[y][x] == '?' || G[y][x] == C[l]) {
	      int nj = j;
	      int nk = k;
	      if((k & 1) && C[l] == 'I') {
		nj = 1;
	      }
	      if(x != 0 && C[l] != 'O') {
		nk = (nk & ~(1<<(W-1)));
	      }
	      if(x != W-1 && C[l] == 'J') {
		nk = (nk | (1<<W));
	      }
	      nk = (nk >> 1);
	      dp[q][nj][nk] = ( dp[q][nj][nk] + dp[p][j][k] ) % mod;
	    }
	  }
	}
      }
    }
    int res = 0;
    for(int k = 0; k < B; ++k) {
      res = ( res + dp[(H*W)%2][1][k] ) % mod;
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 17544
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
 vector<int> vi[maxii];
 vector<int>:: iterator child;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];
bool check[maxii];

bool dfs(int node,int c)
{
    check[node]=true;
    arr2[node]=c;
    for(int child=0;child<vi[node].size();child++)
    {
        if(check[vi[node][child]]==false)
        {
            if(dfs(vi[node][child],c^1)==false)
            {
                return false;
            }
        }
        else if(arr2[node]==arr2[vi[node][child]])
        {
            return false;
        }
        //else if()
    }
    return true;
}

int main()
{
    int n;
    cin>>n;
    int res=n*(n+1);
    res/=2;
    cout<<res;

}


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

int main() {

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((a+b)==(c+d))
        cout << "Balanced" << endl;
    if ((a+b)>(c+d))
        cout << "Left" << endl;
    if ((a+b)<(c+d))
        cout << "Right" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    string s;
    cin >> s;
    bool ans = false;
    if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) ans = true;
    cout << ((ans) ? "Bad" : "Good") << endl;
}

Measured memory_bytes: 256
<?php
  list($n,$a,$b,$c) = explode(" ", trim(fgets(STDIN)));
  $l=[];
  for($i=0;$i<$n;$i++){
    list($l[]) = explode(" ", trim(fgets(STDIN)));
  }
  $sum = [0,0,0,0];
  echo dfs(0,0,0,0,0,$n, $l, [$a,$b,$c],0);

  function dfs($a, $b, $c, $empty, $cnt, $n, $l, $re, $p){
    if($n == $cnt){
      if($a == 0 || $b == 0 || $c == 0){
        return PHP_INT_MAX;
      }else{
        //echo abs($re[0]-$a)." ".abs($re[1]-$b)." ".abs($re[2]-$c)." ".$p.PHP_EOL;
        return abs($re[0]-$a)+abs($re[1]-$b)+abs($re[2]-$c)+$p;
      }
    }
    $ap=$p;
    $bp=$p;
    $cp=$p;
    if($a!=0)$ap=$p+10;
    if($b!=0)$bp=$p+10;
    if($c!=0)$cp=$p+10;
    $x1 = dfs($a+$l[$cnt], $b, $c, $empty, $cnt+1, $n, $l, $re, $ap);
    $x2 = dfs($a, $b+$l[$cnt], $c, $empty, $cnt+1, $n, $l, $re, $bp);
    $x3 = dfs($a, $b, $c+$l[$cnt], $empty, $cnt+1, $n, $l, $re, $cp);
    $x4 = dfs($a, $b, $c, $empty+$l[$cnt], $cnt+1, $n, $l, $re, $p);
    return min($x1, $x2, $x3, $x4);
  }

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

using namespace std;
#define int int64_t
#define rep(i,a,n) for(int i=(a); i<(n); ++i)
#define reps(i,a,n) for(int i=(a); i>(n); --i)
#define all(x) (x).begin(),(x).end()
#define gsort(x, n) sort((x), (x + n) greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed(n) fixed << setprecision(n)
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).flont_back(a)
#define eb(x, a) (x).emplaes_back(a)
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr long long mod = 1e9 + 7;

signed main()
{
	cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n,cnt=0;
    cin>>n;
    vector<int> x(n),y;
    y.resize(n,0);

    rep(i,0,n-1){
        cin>>x[i];
        y[x[i]-1]++;
    }

    rep(i,0,n){
        cout<<y[i]<<'\n';
    }
    return 0;
}

Measured memory_bytes: 6332
#include<cstdio>
#include<algorithm>
#include<vector>
#include<numeric>
#include<functional>

using namespace std;

typedef long long ll;

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

int main(){
	int n; ll W;
	scanf("%d %lld", &n, &W);
	ll w1, v1; scanf("%lld %lld", &w1, &v1);
	vector<ll> s[4]; s[0].push_back(v1);
	rep(i, n - 1){
		ll w, v; scanf("%lld %lld", &w, &v);
		s[w - w1].push_back(v);
	}
	rep(i, 4) sort(s[i].begin(), s[i].end(), greater<ll>());
	ll res = 0;
	rep(i, s[0].size() + 1) rep(j, s[1].size() + 1) rep(k, s[2].size() + 1) rep(l, s[3].size() + 1){
		if(i * w1 + j * (w1 + 1) + k * (w1 + 2) + l * (w1 + 3) > W) continue;
		ll sum = accumulate(s[0].begin(), s[0].begin() + i, 0LL) + accumulate(s[1].begin(), s[1].begin() + j, 0LL);
		sum += accumulate(s[2].begin(), s[2].begin() + k, 0LL) + accumulate(s[3].begin(), s[3].begin() + l, 0LL);
		res = max(res, sum);
	}
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
ans = 0
flag = true
while flag
    if (n==2)||(n==3)
        puts n
        break
    end
    2.upto((n**0.5).floor) do |i|
        if n%i==0
            flag = true
            break
        else
            flag = false
        end
    end
    if flag
        n+=1
    else
        puts n
        break
    end
end

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define fastio    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;


const int INF = 1e9;
const ll MOD = 1e9 + 7;
const int N = 1e3 + 3;

int main() {
    int n;
    cin>>n;
    int ans = 0;

    for(int i =1 ; i <=n ; i++) {
        int tmp;
        cin>>tmp;
        if(i%2 && tmp%2) ans++;
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
void solve(){
  string s,t,r;
  cin>>s;
  cin>>t;
  int ls,lt,k=1e3+1;
  ls=s.size();
  lt=t.size();
  for(int i=0;i<ls-lt+1;i++){
    r=s.substr(i,lt);
    int p=0;
    for (int j=0;j<lt;j++){
      if (r[j]!=t[j]){
        p+=1;
      }
    }
    k=min(p,k);
  }
  cout<<k<<endl;
}
int main(){
  solve();
  return 0;
}

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

int main(void) {

	// TODO: submit前にprintf-debugの削除確認！
	//int N, M;
	int x[4], y[4];

	cin >> x[0] >> y[0] >> x[1] >> y[1];
	
	int diffX = x[1] - x[0];
	int diffY = y[1] - y[0];
	
	x[2] = x[1] - diffY;
	y[2] = y[1] + diffX;
	
	x[3] = x[0] - diffY;
	y[3] = y[0] + diffX;
	
	cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3];
	return 0;
}



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;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;

char afield[60][60];
char bfield[60][60];

int main(){
    int n,m;
    cin >> n >> m;
    rep(i,n){
        string a;
        cin >> a;
        rep(j,n){
            afield[i][j]=a[j];
        }
    }
    rep(i,m){
        string b;
        cin >> b;
        rep(j,m){
            bfield[i][j]=b[j];
        }
    }
    bool flag=false;
    rep(i,n-m+1){
        rep(j,n-m+1){
            flag=false;
            rep(k,m){
                rep(l,m){
                    if(afield[k+i][l+j]!=bfield[k][l]){
                        flag=true;
                        if(flag)break;
                    }
                }
                if(flag)break;
            }
            if(!flag){
                cout << "Yes" << endl;
                return 0;
            }

        }
    }
    cout << "No" << endl;
    return 0;
}

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

int main()
{
	double L;
	cin >> L;
	cout << setprecision(15) << L/3 * L/3 * L/3 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lt long long
using namespace std;
const int N=1e5+5;
const int mod=1e9+7;
const int inf=0x3f3f3f;
int ans[N];
void init()
{
	for (int x=1;x<=100;x++)
		for (int y=1;y<=100;y++)
			for (int z=1;z<=100;z++)
				ans[x*x+y*y+z*z+x*y+y*z+z*x]++;
}
int main()
{
	init();
	int n;
	cin>>n;
	for (int i=1;i<=n;i++)
		 cout<<ans[i]<<endl;
}

Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

template<class T> inline vector<pair<T, int>> factoring(T n) {
	using p = pair<T, int>;
	using vp = vector<p>;
	vp res;
	T k = n;
	if (n % 2 == 0) {
		res.push_back(p(2, 1));
		n /= 2;
		while (n % 2 == 0) {
			res[0].second++;
			n /= 2;
		}
	}
	for (T i = 3; i <= n && i * i <= k; i += 2) {
		if (n % i == 0) {
			res.push_back(p(i, 1));
			n /= i;
			while (n % i == 0) {
				res.back().second++;
				n /= i;
			}
		}
	}
	if (n != 1) {
		res.push_back(p(n, 1));
	}
	return res;
}


template<typename T>
T gcd(T u, T v) {
	if (u == 0)return v;
	if (v == 0)return u;
	T r;
	while (v) {
		r = u % v;
		u = v;
		v = r;
	}
	return u;
}


int main() {
	IOS;
	ll a, b;
	cin >> a >> b;
	ll c = gcd(a, b);
	put(factoring(c).size()+1);
	return 0;
}

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

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()

using namespace std;

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

const int N = 16 ;
const int MOD = 1000000007;
const int LOG = 20;
const ll INF = 1e18;

int n, a[N][N];
ll dp[(1 << N) + 10], sum[(1 << N) + 10];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	for (int i = 0; i < (1 << N); i++){
		dp[i] = -INF;
	}
	cin >> n;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			cin >> a[i][j];
		}
	}
	for (int mask = 1; mask < (1 << n); mask++){
		for (int i = 0; i < n; i++){
			if (mask & (1 << i)){
				sum[mask] = sum[mask ^ (1 << i)];
				for (int j = i + 1; j < n; j++){
					if (mask & (1 << j)) sum[mask] += a[i][j];
				}
				break;
			}
		}
	}
	dp[0] = 0;
	for (int mask = 1; mask < (1 << n); mask++){
		for (int sub = mask; sub; sub = (sub - 1) & mask){
			dp[mask] = max(dp[mask], dp[mask ^ sub] + sum[sub]);
		}
	}
	cout << dp[(1 << n) - 1];



	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

ll gcd (ll a, ll b)
{
    return b ? gcd (b, a%b) : a;
}

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

    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,0,n) cin >> a[i];

    ll ans(LL_MAX);
    rep(i,1,n) ans = min(ans, gcd(a[i], a[i-1])); 

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
/*
created on 22/4/2020
*/
#include<bits/stdc++.h>
using namespace std;
#define Endl '\n'
typedef long long int lli;
void solve();
int main(int argc, char const *argv[]){
  // ios_base::sync_with_stdio(false);
  // cin.tie(0);
  solve();
}

int N;
int arr[22][22];
int const MOD = (1e9) + 7;
int memo[22][1<<22];
int findans(int pos, int bitmask){
  if(pos == N)
    return 1;
  int &ans= memo[pos][bitmask];
  if(ans!=-1)
    return ans%MOD;
  ans = 0;
  for(int i=0;i<N;i++){
    if(arr[pos][i] == 1 && ((bitmask&(1<<i)) == 0)){
      ans = (ans%MOD + findans(pos+1, bitmask|(1<<i))%MOD)%MOD;
    }
  }
  return ans%=MOD;
}
void solve(){
  cin>>N;
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++)
      cin>>arr[i][j];
  }
  memset(memo, -1, sizeof memo);
  int ans = findans(0, 0);
  cout<<ans<<Endl;
}


Measured memory_bytes: 360832
// #include <bits/stdc++.h>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>
#include<functional>
#include <bitset>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
using namespace std;
typedef long long ll;
typedef long long int lli;
// static const int MOD = 998244353;
// static const int MAX = 100005;
// static const int ls = 101;
// static const int NMAX = 5005;
// static const lli INFTY = 1000000000000;

// typedef priority_queue<int, greater<int>> RevQ;
int n;
// string s;
// lli l, r;
// lli gcd(lli a, lli b) {
//   return b ? gcd(b, a%b) : a;
// }
int facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

double dist(int x1, int x2, int y1, int y2) {
  double sq;
  double kyori;
  sq = pow((x1 - x2), 2.0) + pow((y1 - y2),2.0);
  kyori = sqrt(sq);
  return kyori;
}

int main(){
  cin >> n;
  vector<int> x(n), y(n);
  double com = (n*(n-1))/2;
  // vector<ll> ans(com);
  rep(i, n) {
    cin >> x[i] >> y[i];
  }
  double ans = 0;
  rep(i, n) {
    REP(j, i+1, n) {
      double s = dist(x[i], x[j], y[i], y[j]);
      // cout << s << endl;
      ans += s;
    }
  }
  ans *= (n-1);
  // cout << dist(x[0], x[1], y[0], y[1]) << endl;
  ans = (double) ans/com;
  printf("%.8f\n", ans);
  // cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A;
  int B;
  cin>>A>>B;
  if(A<6){
    cout<<0<<endl;
  }
  else if(A<13){
    cout << B/2 << endl;
  }
  else{
    cout << B<< endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[10004][10004];
int cal(int i , int j , int d){
	int ans = 0;
	for(int k = 0 ; k < d ; k++){
		ans += ((a[i][k] - a[j][k])*(a[i][k] - a[j][k]));
	}
	return ans;
}
int main() {
   	int n , d;
   	cin >> n >> d;
   	
   	for(int i = 0 ; i < n ; i++){
   		for(int j = 0 ; j < d ; j++){
   			cin >> a[i][j];
   		}
   	}
   	int ans = 3 , cnt = 0;
   	for(int i = 0 ; i < n ; i++){
   		for(int j = i + 1 ; j < n; j++){
   			
   			ans = cal(i , j , d);
   			double a = sqrt(double(ans));
   			if(a - floor(a) == 0)
   				cnt++;
		}
	}
	cout << cnt << endl;
}

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

int arr[20][1010];
int cnt[20][1010];

int main()
{
    int n, m, k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i=1; i<=n; ++i){
        for(int j=1; j<=m; ++j){
            scanf("%1d", &arr[i][j]);
            cnt[i][j] = cnt[i-1][j] + arr[i][j];
        }
    }
    int ans = n+m;
    for(int rcut=0; rcut<(1<<(n-1)); ++rcut){
        vector<int> row_cut;
        row_cut.push_back(0);
        for(int tmp = rcut, i=1; tmp; tmp>>=1, ++i){
            if(tmp&1) row_cut.push_back(i);
        }
        int count = row_cut.size()-1, rcnt = row_cut.size();
        vector<int> whites;
        for(int i=0; i<rcnt; ++i) whites.push_back(0);
        row_cut.push_back(n);
        if(count > ans) continue;
        bool possible = true;
        for(int j=1; j<=m; ++j){
            bool sw = false;
            for(int i=0; i<row_cut.size()-1; ++i){
                // row_cut[i] ~ row_cut[i+1]
                if(cnt[row_cut[i+1]][j] - cnt[row_cut[i]][j] > k) possible = false;
                if(whites[i] + cnt[row_cut[i+1]][j] - cnt[row_cut[i]][j] > k){ sw = true; break; }
            }
            if(sw){
                ++count;
                for(int i=0; i<row_cut.size()-1; ++i) whites[i] = 0;
            }
            for(int i=0; i<row_cut.size()-1; ++i){
                whites[i] += cnt[row_cut[i+1]][j] - cnt[row_cut[i]][j];
            }
        }
        if(possible) ans = min(ans, count);
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define pb pop_back
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define Sim template<class n
Sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
Sim> auto operator << (ostream &p, n y) -> 
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
Sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
Sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
Sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " = ", (x), " "
#define A(a, i) #a "[" #i " = ", i, "] = ", a[i], " "

VPII E;

void solve(int n)
{
	int s = n + 1;
	FOR(i, 1, n)
	{
		FOR(j, i + 1, n)
		{
			if (i + j != s)
			{
				E.PB(MP(i, j));
			}
		}
	}
}

int main()
{
	//ios_base::sync_with_stdio(0);
	//cin.tie(NULL);
	int n;
	scanf("%d", &n);
	if (n % 2 == 1)
	{
		solve(n - 1);
		FOR(i, 1, n - 1)
		{
			E.PB(MP(i, n));
		}
	}
	else
	{
		solve(n);
	}
	printf("%d\n", SIZ(E));
	for (auto x : E)
	{
		printf("%d %d\n", x.f, x.s);
	}
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	for (int i = 1;i<10;i++) {
		for (int j = 1; j< 10; j++) {
			if (i*j==n) {
				printf("Yes\n"); return 0;
			}
		}
	}
	printf("No\n"); return 0;
}


Measured memory_bytes: 128