akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

const long long M = 998244353;


const int L=4e5+1;
char buf[L];
string debug(int v, int N){
	string s;
	for(int i=0;i<N;i++){
		s+='0'+v%2;
		v/=2;
	}
	reverse(s.begin(),s.end());
	return s;
}
int ok(int v,int N)
{
	int k=v;
	set<int> done;
	while(done.count(k)==0){
		done.insert(k);
		//cerr << debug(k,N) << endl;
		if(k%2==0){
			k/=2;
			k+=1<<(N-1);
		}
		else{
			k/=2;
		}
	}
	return k==v?done.size()%M:0;
}
LL pw[L];
long long N;
LL f(int k){
	LL ret=0;
	int h=k/2;
	for(int i=0;i<h;i++){
		if(buf[i]=='1'){
			ret+=pw[h-i-1];
			ret%=M;
		}
	}
	for(int i=0;i<N;i++){
		char v=buf[i%h]-'0';
		if((i/h)%2){
			v^=1;
		}
		char w=buf[i]-'0';
		if(v<w){
			break;
		}
		else if(v>w){
			return ret;
		}
	}
	return ret+1;
}
LL cnt[L];
int main(){
    scanf("%lld",&N);
    scanf("%s",buf);
#if 0
	LL t=0;
	for(int i=0;i<N;i++){
		t*=2;
		t+=buf[i]-'0';
	}
	for(int i=0;i<=t;i++){
		cout << debug(i,N) << ": " << ok(i,N) << endl;
	}
#else
	pw[0]=1;
	for(int i=1;i<L;i++){
		pw[i]=2*pw[i-1]%M;
		
	}
	LL ret=0;
	for(int k=2;k<=2*N;k+=2){
		if(2*N%k){
			continue;
		}
		if((2*N/k)%2==0){
			continue;
		}
		//cerr << k << ", " << f(k) << endl;
		cnt[k]+=f(k);
		cnt[k]%=M;
		ret+=k*cnt[k]%M;
		ret%=M;
		for(int j=2*k;j<=2*N;j+=k){
			cnt[j]+=M-cnt[k];
			cnt[j]%=M;
		}
	}
	cout << ret << endl;
#endif




    return 0;
}


Measured memory_bytes: 6656
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
const int Inf = 1e9;
int a, b, c, d;
int ans;

int main() {
	while(~scanf("%d %d %d %d", &a, &b, &c, &d)) {
		int r1, r2;
		/*if(a <= b) r1 = a;
		else r1 = b;
		if(c <= d) r2 = c;
		else r2 = d;*/
		r1 = (a <= b ? a : b);
		r2 = (c <= d ? c : d);
		ans = r1 + r2;
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 128
import sys

# sys.stdin = open("c1.in")


def solve():
    n = int(input())
    s = []
    for i in range(n):
        y = int(input())
        s.append(y)


    c = 0
    for x in s:
        if x % 10 == 0:
            c += 1
    if c == n:
        return 0

    r = 0
    if sum(s) != 0 and sum(s) % 10 != 0:
        return sum(s)
    else:
        m = 10 ** 20
        for x in s:
            if x % 10 != 0:
                if x < m:
                    m = x
        return sum(s) - m


res = solve()
print(res)


Measured memory_bytes: 3064
// DP
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

type intSlice []int

func (s intSlice) fill(x int) {
	for i := 0; i < len(s); i++ {
		s[i] = x
	}
}

func main() {
	const maxW = 100000

	N := readInt()
	W := readInt()

	dp := make(intSlice, maxW+1)
	dp.fill(math.MaxInt64)
	dp[0] = 0

	for i := 0; i < N; i++ {
		w := readInt()
		v := readInt()
		for j := maxW - v; j >= 0; j-- {
			if dp[j] == math.MaxInt64 {
				continue
			}
			if dp[j]+w <= W {
				dp[j+v] = min(dp[j+v], dp[j]+w)
			}
		}
	}
	for j := maxW; j >= 0; j-- {
		if dp[j] == math.MaxInt64 {
			continue
		}
		fmt.Println(j)
		break
	}
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 1408
import sys
input = sys.stdin.readline
from collections import deque

n = int(input())
U = n**2
G = [[] for _ in range(U)]
parent = [0]*U
for i in range(n):
  A = list(map(lambda x:int(x)-1, input().split()))
  for j in range(n-2):
    a = A[j]
    b = A[j+1]
    G[min(i, a)*n+max(i, a)].append(min(i, b)*n+max(i, b))
    parent[min(i, b)*n+max(i, b)] += 1

que = deque([(i*n+j, 1) for i in range(n-1) for j in range(i+1, n) if not parent[i*n+j]])
ans = 1
cnt = 0
while que:
  v, t = que.pop()
  ans = max(ans, t)
  cnt += 1
  for nv in G[v]:
    parent[nv] -= 1
    if not parent[nv]:
      que.appendleft((nv, t+1))
if cnt == n*(n-1)//2:
  print(ans)
else:
  print(-1)

Measured memory_bytes: 129432
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int H = in.nextInt();
            int W = in.nextInt();
            int h = in.nextInt();
            int w = in.nextInt();
            System.out.println((H - h) * (W - w));
        }
    }
}


Measured memory_bytes: 25428
N = gets.to_i
A = gets.split.map(&:to_i)

sum = Array.new(N+1) {0}

(0..A.size-1).each do |i|
  sum[i + 1] = sum[i] + A[i]
end

map = Hash.new {0}
sum.each do |s|
  map[s] += 1
end

sum = 0
map.each do |k,v|
  if v < 2
    next
  end
  sum += v*(v-1)/2
end

puts sum


Measured memory_bytes: 30604
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//for(int i = 0; i<n; i++)
 
 
int main()
{
    int n;cin>>n;
    int a,b; cin>>a>>b;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        int j = i;
        int sum = 0;
        while(j){
            sum += j % 10;
            j /= 10;
        }
        if(sum >= a && sum <= b) ans += i;
    }
    cout << ans << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
using namespace std;
typedef long long ll;

int main(){
    int n;
    scanf("%d\n",&n);
    for(int ix=0;ix<n;ix++){
        int h,m;
        scanf("%d:%d\n",&h,&m);
        int tan=(60*h+m)%720,tyo=(12*m)%720,dist=min(abs(tan-tyo),720-abs(tan-tyo));
        if(dist<60) printf("alert\n");
        else if(180<=dist) printf("safe\n");
        else printf("warning\n");
    }
}

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

using pii = pair<int, int>;
using ll  = long long;
#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for (int i = (j); i < (int)(k); i++)
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " : " << x << endl

template <class T>
bool set_min(T &a, const T &b) {
    return a > b ? a = b, true : false;
}
template <class T>
bool set_max(T &a, const T &b) {
    return a < b ? a = b, true : false;
}
// vector
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &a : v) is >> a;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (const T &t : v) os << "\t" << t;
    return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
    return os << "<" << v.first << ", " << v.second << ">";
}

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

template <typename T>
T gcd(T a, T b) {
    T c = a, d = b, r;
    do {
        r = c % d;
        c = d;
        d = r;
    } while (r);
    return c;
}

template <typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

class Solver {
  public:
    bool solve() {
        ll N, M;
        cin >> N >> M;
        string S, T;
        cin >> S >> T;
        if (N > M) {
            swap(N, M);
            swap(S, T);
        }
        rep(i, N) {
            if (M * i % N != 0) continue;
            if (T[M * i / N] != S[i]) {
                cout << -1 << endl;
                return 0;
            }
        }
        cout << lcm<ll>(M, N) << endl;
        return 0;
    }
};

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


Measured memory_bytes: 640
#include<iostream>
#include<vector>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<int> a(n+1);
	for(int i=1;i<=n;i++){
		cin >> a[i];
	}
	int ans=-1;
	int count=0;
	int p=1;
	while(n--){
		if(a[p]==2){
			ans=count+1;
			break;
		}
		count++;
		p=a[p];
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    a = ii()
    b = ii()
    h = ii()
    print(((a+b)*h)//2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10096
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(NULL);
void solve(){
	ll n, d, x, y;
	cin>>n>>d;
	d *= d;
	int cnt = 0;
	for(int i = 0; i < n; i++){
		cin>>x>>y;
		if((x * x) + (y * y) <= d) cnt++;
	}
	cout<<cnt;
}
	
int main(){
	solve();
	return 0;
}
	


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

int main() {
  int n;
  cin >> n;
  int c[3];
  memset(c,0,sizeof(c));
  for(int i=0; i<n; i++) {
    int x;
    cin >> x;
    c[x%3]++;
  }
  int ans=1;
  for(int i=1; i<=2; i++) {
    if(c[i]) {
      int x=c[i],y=c[3-i],z=c[0],cnt=0;
      x--;
      cnt++;
      if(y==0) {
        cnt+=min(2,x);
      } else if(x>y) {
        int d=min(y+1,x);
        cnt+=y+d;
        x-=d;
        if(x) cnt++;
      } else {
        cnt+=x*2;
        y-=x;
        if(y) cnt++;
      }
      cnt+=z;
      ans=max(ans,cnt);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const ll mod = (ll)1e9+7;
const int INF = 0x3f3f3f3f;

int a[100001];

int mpow(int b, int e)
{
    int ret=1;
    for(int i=0; i<e; i++)
    {
        ret=ret*b%mod;
    }
    return ret;
}

vector<int> g[9];
int ans=0;
ll n, m;

void dfs(int i, int s, vector<int> v)
{
    if(s==n)
    {
        ans++;
        return;
    }
    v[i]=1;
    for(int j=0; j<(int)g[i].size(); j++)
    {
        if(!v[g[i][j]])
        {
            dfs(g[i][j], s+1, v);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    for(int i=0; i<m; i++)
    {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> v(9);
    dfs(1, 1, v);
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string.h>
using namespace std;
typedef long long ll;
int main()
{
    ll a,b,n;
    cin>>a>>b>>n;
    ll m=0;
    m=a*min(b-1,n)/b;
    cout<<m<<endl;
}


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

int main(){
  int N, count;
  cin >> N;
  vector<int> d(N);
  for (int i=0; i<d.size(); i++) {
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  count = 1;
  for (int i=1; i<d.size(); i++) {
    if (d.at(i) < d.at(i-1))
      count++;
  }
  cout << count << endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low,high,i) for(i = low;i < high;i++)
#define forrev(high,low,i) for(i = high; i >= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';        
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9 + 7;

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

int main(){
  fastio

  ll n, i, j, k;

  cin >> n;

  vl a(n);

  forn(0, n, i){
    cin >> a[i];
  }

  sort(all(a));

  ld sum = a[0];
  ll prod = 1;
  forn(1, n, i){
    sum += a[i];
    sum /= 2;
  }

  decimal_digits

  cout << sum << '\n';

  ktj();
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    //lol result{0};
    string s; cin >> s;
    lol len = s.length();
    REP(i, len)
    {
        cout << 'x';
    }
    cout << endl;
    

    //cout << result << endl;
    return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n, k, q, p;
	cin >> n >> k >> q;
	VI a(n + 1, 0);
	REP(i, q) {
		cin >> p;
		a[p]++;
	}
	REP(i, n) {
		if (k - q + a[i + 1] > 0)
			cout << "Yes" << '\n';
		else
			cout << "No" << '\n';
	}
}

Measured memory_bytes: 1024
#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 a, b;
  cin >> a >> b;
  int flag = 0;

  if(a == b){
    cout << b;
  }
  else if(a>b){
    cout << a - 1;
  }
  else{
    cout << a;
  }
}


Measured memory_bytes: 3616
#include <stdio.h>
#define MAX_SIZE 100001
#define ll long long

ll T, test_case, ans;
int N, X;
int i, j, k;
int a[MAX_SIZE];


int main(int argc, char** argv) {

	scanf("%d", &X);
	int cnt = 1;
	while (360 * cnt % X != 0)
		cnt++;
	printf("%d", 360 * cnt / X);


	return 0;
}

Measured memory_bytes: 1736
#include<iostream>
using namespace std;
long N,M,mod=998244353;
long F[1<<25],I[1<<25];
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
long C(long a,long b)
{
	return a<b||a<0||b<0?0:F[a]*I[b]%mod*I[a-b]%mod;
}
long H(long a,long b){return a<0?0:C(a+b-1,b-1);}
main()
{
	cin>>N>>M;
	long T=2*M+N;
	F[0]=1;
	for(long i=1;i<T;i++)F[i]=F[i-1]*i%mod;
	I[T-1]=power(F[T-1],mod-2);
	for(long i=T-1;i--;)I[i]=I[i+1]*(i+1)%mod;
	long ans=0;
	for(int i=0;i<=N&&i<=M;i++)
	{
		if((3*M-i)%2==1)continue;
		(ans+=C(N,i)*H((3*M-i)/2,N)%mod)%=mod;
	}
	long ret=0;
	for(int i=1;i<=N&&i<=M;i++)
	{
		if((M-i)%2==1)continue;
		(ret+=C(N-1,i-1)*H((M-i)/2,N)%mod)%=mod;
	}
	for(int i=0;i<=N-1&&i<=M;i++)
	{
		if((M-i)%2==1)continue;
		(ret+=C(N-1,i)*H((M-i-2)/2,N)%mod)%=mod;
	}
	cout<<(ans-ret*N%mod+mod)%mod<<endl;
}


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

using namespace std;

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

#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(0, c - (a-b)) << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define pb(x) push_back(x)
#define HAYAKU_HAYAKU ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    HAYAKU_HAYAKU; 
    int n,k;
    cin>>n>>k;
    int a[n+1];
    for(int i = 1; i <= n; i++)
        cin>>a[i];
    unsigned long long int prev=1,gr=1;
    int i;
    for (i = 1; i+k <= n; i++)
    {
        //out<<a[i]<<' '<<a[i+k]<<endl;
        a[i] < a[i+k] ? cout<<"Yes\n" : cout<<"No\n";
    }
    
}

Measured memory_bytes: 4292
#include <cstdio>
#include <algorithm>
using namespace std;
int c[100];
int calc(int n, int k) {
    int s=0, mt=0;
    for (int i=0; i<=n-k; i++) {
        int temp=1;
        for (int j=0; j<k; j++) temp*=c[i+j];
        mt=max(mt, temp);
    }
    return mt;
}
int main() {
    int n, k;
    while (scanf("%d%d",&n,&k)) {
        if (!n&&!k) break;
        for (int i=0; i<n; i++) scanf("%d",&c[i]);
        int mt=calc(n,k), res=0;
        for (int i=0; i<n; i++) {
            for (int j=i+1; j<n; j++) {
                swap(c[i],c[j]);
                res=max(res, calc(n,k));
                swap(c[i],c[j]);
            }
        }
        // printf("%d %d\n",res, mt);
        if (res<mt) puts("NO GAME");
        else printf("%d\n",res-mt);
    }
}

Measured memory_bytes: 756
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;


int main(){

    int N,X,Y;
    cin >> N >> X >> Y;

    vector<long> data(N,0);
    int key;

    for(int i=1;i<N;i++){
        for(int j=i+1;j<=N;j++){
            key = min( j-i, abs(X-i)+abs(Y-j)+1 );
            data[key]++;
        }
    }

    for(int i=1;i<N;i++){
        cout << data[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>
#include <numeric>
#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    int ans = 1e9;
    for(int i = 0;i <= max(x,y)*2;i+=2)
    {
        int rx,ry;
        rx = max(x - i/2, 0);
        ry = max(y - i/2, 0);
        ans = min(ans, i*c+rx*a+ry*b);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;


   


    cout << (a!=c?1:0) << endl;

   return 0;
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		Map<Integer,List<Integer>> map = new HashMap<>();
		int[] num_parent = new int[n+1];
		for(int i=0;i<n+m-1;i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			num_parent[b]++;
			if(map.containsKey(a)) {
				map.get(a).add(b);
			}else {
				List<Integer> list = new ArrayList<>();
				list.add(b);
				map.put(a, list);
			}
		}
		int[] ans = new int[n+1];
		Queue<Integer> que = new ArrayDeque<>(n+m-1);
		for(int i=1;i<n+1;i++) {
			if(num_parent[i]==0) {
				que.add(i);
				num_parent[i]++;
			}
		}
		while(!que.isEmpty()) {
			int parent = que.poll();
			num_parent[parent]--;
			if(num_parent[parent]==0) {
				if(map.containsKey(parent)) {
					List<Integer> list = map.get(parent);
					for(int node : list) {
						ans[node] = parent;
						que.add(node);
					}
				}
			}
			
		}
		for(int i=1;i<n+1;i++) {
			System.out.println(ans[i]);
		}
		in.close();
		
	}

}


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

int main() {
  // ここにプログラムを追記
int a;
int b= 0;
  cin >> a;
if(a%10==1)b++;
 if((a/10)%10==1)b++;
  if((a/100)%10==1)b++;
  cout << b << endl; 
}

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

ll solve (ll n) {
	if (n < 10) return n;
	ll i = 9, ans = 0;
	while (i < n) {
		i = i * 10 + 9;
		ans += 9;
	}
	i /= 10;
	ll j = n / (i + 1);
	ans += j - 1;
	n -= j * (i + 1);
	return max(ans, j + solve(n));
}

int main() {
	ll n;
	cin >> n;
	ll ans = solve(n);
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import math

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

Dp1 = 0
Dp2 = 0
Dp3 = 0
Dp4 = []
for i in range(n):
 xyi = abs(x[i] - y[i])
 Dp1 += xyi
 Dp2 += xyi ** 2
 Dp3 += xyi ** 3
 Dp4.append(xyi)
print("{0:05f}".format(Dp1))
print("{0:05f}".format(math.sqrt(Dp2)))
print("{0:05f}".format(math.pow(Dp3, (1 / 3))))
print("{0:05f}".format(max(Dp4)))

Measured memory_bytes: 7784
num = int(input())
s = list(input())

temp = ord(s[0])
next = temp + num

if next>ord('Z'):
  next = next -ord("Z")-1+ord("A")

s_new = chr(next)

for i in range(1,len(s)):
  temp = ord(s[i])
  next = temp + num
  
  if next>ord('Z'):
    next = next -ord("Z")-1+ord("A")
   
  s_new = s_new + chr(next)

  
print(s_new)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0; }
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S, T;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path;
//***********//
int main() {
	cin >> N;
	ll p = 5;
	if (N % 2 == 1) {
		cout << 0;
	}
	else {
		while (p*2 <= N) {
			ans += N / (p*2);
			p *= 5;
		}
		cout << ans;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
int main()
{ 
 ios_base::sync_with_stdio(false);
 cin.tie(NULL);

 ll n;
 cin>>n;
 ll a[n];
 ll sum=0;
 for(ll i=0;i<n;i++)
 {
  ll x=i+1;
  if(x%5!=0&&x%3!=0)sum+=x;
 }
 cout<<sum<<endl;

}
 
 

Measured memory_bytes: 3600
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,S;
    cin >> N >> S;
    vl A(N);
    rep(i,N){
        cin >> A[i];
    }
    ll dp[N+1][S+1][3];
    rep(i,N+1){
        rep(j,S+1){
          	rep(k,3){
            dp[i][j][k]=0;
            }
        }
    }
    dp[0][0][0]=1;
    FOR(i,1,N+1){
        rep(j,S+1){
          	dp[i][j][0]+=dp[i-1][j][0];
          	dp[i][j][1]+=dp[i-1][j][0]+dp[i-1][j][1];
          	dp[i][j][2]+=dp[i-1][j][0]+dp[i-1][j][1]+dp[i-1][j][2];
          	if(j-A[i-1]>=0){
              	dp[i][j][1]+=dp[i-1][j-A[i-1]][0]+dp[i-1][j-A[i-1]][1];
              	dp[i][j][2]+=dp[i-1][j-A[i-1]][0]+dp[i-1][j-A[i-1]][1];
            }
          	rep(k,3){
              	dp[i][j][k]%=MOD2;
            }
        }
    }
  	cout << dp[N][S][2] << endl;
}

Measured memory_bytes: 214736
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		char[] ch = scn.nextLine().toCharArray();
		int R = 0, B = 0;
		for(int i = 0;i < ch.length;i++) {
			if(ch[i] == '0') {
				R++;
			}else {
				B++;
			}
		}
		System.out.println(Math.min(R, B)*2);
	}

}


Measured memory_bytes: 28616
#include <bits/stdc++.h>//coded by Nurstan ^_^

#define ll long long
#define pb push_back

#define mp make_pair
#define lb lower_bound
#define ub upper_bound

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

// fixed << setprecision
// next_permutation(a, a + n)
// set <int> :: iterator it = x.begin(); it != x.end(); it ++

using namespace std;

inline void boost(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}
int l, r, n, m;
int main(){
	boost();
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	string a;
	cin >> a;
	string b = "";
	b += a[0];
	for(int i = 1; i < a.size(); i ++) {
		if(a[i] != a[i - 1]) {
			b += a[i];
		}
	}
	for(int i = 0; i < b.size(); i ++) {
		if(b[i] == 'N') {
			l ++;
		}
		else if(b[i] == 'S') {
			r ++;
		}
		else if(b[i] == 'E') {
			n ++;
		}
		else if(b[i] == 'W') {
			m ++;
		}
	}
	if(n == 0 && m != 0 || n != 0 && m == 0) {
		cout << "No";
		return 0;
	}
	if(l == 0 && r != 0 || l != 0 && r == 0) {
		cout << "No";
		return 0; 
	}
	if(abs(n - m) <= 1 && abs(l - r) <= 1) {
		cout << "Yes";
		return 0;
	}
	else {
		cout << "No";
	}
	exit(0);
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int x,y,amari,tmp;
  scanf("%d%d",&x,&y);
  if(x<y){
    tmp=x;
    x=y;
    y=tmp;
  }
  amari=x%y;
  while(amari!=0){
    x=y;
    y=amari;
    amari=x%y;
  }
  printf("%d\n",y);
  return 0;
}

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

const long long md=1e9+7;
long long dp[305][4][4][4];
char c[100];
int n;
string s,ss,s1="AGC";

inline bool check(string s) {
	string ss="";
	ss+=s[0];
	ss+=s[1];
	ss+=s[2];
	if(s1==ss) return false;
	if((int)s.size()==3) return true;
	ss="";
	ss+=s[1];
	ss+=s[2];
	ss+=s[3];
	if(s1==ss) return false;
	return true;
}

int main() {
	cin>>n;
	if (n == 1) {
		puts("4");
		return 0;
	}
	if (n == 2) {
		puts("16");
		return 0;
	}
	c[0]='A';
	c[1]='C';
	c[2]='G';
	c[3]='T';
	for (int i=0;i<4;++i)
		for (int j=0; j<4;++j)
			for (int k=0;k<4; ++k) {
				ss="";
				ss+=c[i];
				ss+=c[j];
				ss+=c[k];
				if(!check(ss)) continue;
				swap(ss[1], ss[2]);
				if(!check(ss)) continue;
				swap(ss[1], ss[2]);
				swap(ss[0], ss[1]);
				if(!check(ss)) continue;
				dp[3][i][j][k]=1;
			}
	for (int i=3; i<n; ++i)
		for (int j=0; j<4; ++j)
			for (int k=0; k<4; ++k)
				for (int z=0; z<4; ++z)
					for (int zz=0; zz<4; ++zz) {
						ss=c[j];
						ss+=c[k];
						ss+=c[z];
						ss+=c[zz];
						if (!check(ss)) continue;
						bool t=false;
						for (int l=1; l<4; ++l) {
							swap(ss[l-1],ss[l]);
							if(!check(ss)) {
								t=true;
								break;
							}
							swap(ss[l-1],ss[l]);
						}
						if (!t) dp[i+1][k][z][zz] = (dp[i+1][k][z][zz]+dp[i][j][k][z])%md;
					}
	long long ans=0;
	for (int i=0; i<4; ++i)
		for (int j=0; j<4; ++j)
			for (int k=0;k<4; ++k)
				ans+=dp[n][i][j][k];
	ans%=md;
	printf("%lld\n",ans);
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 22;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int solve(const vvi &g, vector<bool> sel, int n, int k) {
  if(k == SZ(g)-1) return 1;
  sel[n] = true;
  int ans = 0;
  REP(i, SZ(g[n])) {
    if(sel[g[n][i]] == 0) ans += solve(g, sel, g[n][i], k+1);
  }
  return ans;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  int n, m; cin >> n >> m;
  vvi g(n);
  REP(i, m) {
    int a, b; cin >> a >> b;
    g[a-1].pb(b-1);
    g[b-1].pb(a-1);
  }

  vector<bool> sel(n, false);
  cout << solve(g, sel, 0, 0) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define ll long long

int main()
{
   	int a, b, h, m;
   	cin >> a >> b >> h >> m;
   	double x = 1.0*h*5+1.0*m/12;
   
	double y = 1.0*m;
	double z = fabs(x-y);
   	double jd = 1.0*z*6*(pi/180);
   	double c = sqrt(a*a+b*b-2*a*b*cos(jd));
   	printf("%.10lf", c);
    return 0;
}

Measured memory_bytes: 4160
#include<stdio.h>
int a,b,c,d[3001],e[3001],f[3001][3001],i,j,m=0,k;
int main(void)
{
    scanf("%d %d %d",&a,&b,&c);
    for(i=0;i<a;i++) scanf("%d %d",&d[i],&e[i]);
    for(i=0;i<=a;i++) for(j=0;j<=b;j++) f[i][j]=-1;
    f[0][0]=0;
    for(i=0;i<a;i++){
        for(j=0;j<=b;j++){
            if(f[i][j]!=-1){
                if(j<c && c<e[i]+j){
                    if(b>=c+e[i]){
                        if(f[i+1][c+e[i]]<f[i][j]+d[i])  f[i+1][c+e[i]]=f[i][j]+d[i];
                    } 
                }
                else{
                    if(f[i][j]+d[i]>f[i+1][j+e[i]]) if(j+e[i]<=b) f[i+1][j+e[i]]=f[i][j]+d[i];
                }
				if(f[i][j]>f[i+1][j]) f[i+1][j]=f[i][j];
            }
        }
    }
	/*for(i=0;i<=a;i++){
		for(j=0;j<=b;j++)printf("%5d",f[i][j]);
		printf("\n");
	}*/
	for(i=0;i<=b;i++) if(m<f[a][i]) m=f[a][i];
    printf("%d\n",m);
    return 0;
}
 

Measured memory_bytes: 37896
#include<bits/stdc++.h>
#define int long long int
#define sci(n) scanf("%lld",&n)
#define pri(n) printf("%lld",n)
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fl2(i,a,b) for(int i=(a);i<(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define nl printf("\n")
#define spc printf(" ")
#define pii pair<int,int>
#define piii pair<pii,int>
#define mii map<int,int>
#define msi map<string,int>
#define mci map<char,int>
#define mss map<string,string>
using namespace std;


int32_t main()
{

//#ifdef ONPC
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
//#endif
    int a,b;
    sci(a);
    sci(b);
    cout<<(a*b)/__gcd(a,b)<<endl;



    return 0;
}


Measured memory_bytes: 256
/*
https://atcoder.jp/contests/practice2/tasks/practice2_a
*/

#include<bits/stdc++.h>
using namespace std;

bool db = false;
typedef long long LL;
typedef long double LD;
typedef long double LD;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<LL, pll> pl_ll;
typedef pair<pll, LL> pll_l;

const LL INF = 1e18+1;

const LL maxn = 2*1e6+1;

LL t, n, m, q;
//LL a[maxn+1];

int p[maxn];
int r(int u) {
    return p[u] < 0 ? u : p[u] = r(p[u]);
}
bool same(int u, int v) {
    return r(u) == r(v);
}
void merge(int u, int v) {
    u = r(u);
    v = r(v);
    if(u == v)
        return;
    if(p[u] > p[v])
        swap(u, v);
    p[u] += p[v];
    p[v] = u;
}
int main() {

#ifdef MY_FILE_INPUT
    db = false;
    db = true;
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    memset(p, -1, sizeof(p));
    cin >> n >> q;
    for(int i = 0; i < q; i++) {
        int u, v;
        cin >> t >> u >> v;
        if(t == 0) merge(u, v);
        else if(same(u, v)) cout << 1 << endl;
        else cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 11424
s = input()

flg = True
for i in range(len(s)):
  if( ( (i%2==0) and (s[i] == "L") ) or ( (i%2==1) and (s[i] == "R"))):
    flg = False
    break

if(flg):
  print("Yes")
else:
  print("No")

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  vector<int> A(101);
  for(int i = a; i <= b; i++){
    A[i]++;
  }
  for(int i = c; i <= d; i++){
    A[i]++;
  }
  int ans = 0;
  for(int i = 0; i <= 100; i++){
    if(A[i] == 2) ans++;
  }
  if(ans == 0) cout << 0 << endl;
  else cout << ans - 1 << endl;
}


Measured memory_bytes: 3628
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var aa = ToIntArray(input.ReadLine(), n);

        var dic = new Dictionary<int, int>();
        foreach(var a in aa) {
            if (!dic.ContainsKey(a)) dic.Add(a, 0);
            dic[a]++;
        }

        var dic2 = new Dictionary<int, long>();
        var dic3 = new Dictionary<int, long>();
        var sum = 0L;

        foreach(var a in dic.Keys) {
            var c = dic[a];
            dic2[a] = Combination(c-1, 2);
            dic3[a] = Combination(c, 2);
            sum += dic3[a];
        }

        var bu = new StringBuilder();

        for(int i=0; i<n; i++) {
            var a = aa[i];
            var c = sum - dic3[a] + dic2[a];

            bu.AppendLine(c.ToString());
        }

        return bu;
    }

    static long Combination(long m, long n) {
        if (n > m) return 0;
        if (m == n || n == 0) return 1;

        long ans = 1;
        for (long i = 1; i <= n; i++) {
            ans = ans * (m - i + 1) / i;
        }
        return ans;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}

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

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

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

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


int main() {
  char a; cin >> a;
  if(isupper(a)) { cout << 'A' << endl; }
  else { cout << 'a' << endl; }
  return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
    int A, B;
    cin >> A >> B;
    vector<string> ans(1);

    rep(i, A - 1)
    {
        if (ans.back().size() < 100)
        {
            ans.back() += ".#";
        }
        else
        {
            ans.push_back(string(100, '#'));
            ans.push_back(".#");
        }
    }
    ans.back() += string(100 - ans.back().size(), '#');
    ans.push_back(string(100, '#'));
    ans.push_back(string(100, '.'));

    if (B != 1)
    {
        ans.push_back(".#");
    }
    rep(i, B - 2)
    {
        if (ans.back().size() < 100)
        {
            ans.back() += ".#";
        }
        else
        {
            ans.push_back(string(100, '.'));
            ans.push_back(".#");
        }
    }
    ans.back() += string(100 - ans.back().size(), '.');

    int h, w;
    h = ans.size();
    w = 100;
    cout << h << " " << w << endl;
    rep(i, ans.size())
    {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>

const int X_MAX = 20;
const int X_MIN = -20;

int main() {
    int n, d;
    std::set<int> squares;
    std::vector< std::vector<int> > x;

    std::cin >> n >> d;
    x.resize(n);
    for (int i = 0; i < n; i++) {
        x[i].resize(d);
        for (int j = 0; j < d; j++) {
            std::cin >> x[i][j];
        }
    }

    for (int i = 1; i * i <= (X_MAX - X_MIN) * (X_MAX - X_MIN) * d; i++) {
        squares.insert(i * i);
    }

    int c = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            int r = 0;
            for (int k = 0; k < d; k++) {
                r += (x[j][k] - x[i][k]) * (x[j][k] - x[i][k]);
            }

            if (squares.count(r) > 0) {
                c++;
            }
        }
    }

    std::cout << c << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
using namespace std;
int main(){
	int d, n;
	cin >> d >> n;
	int h[205];
	for (int i = 1; i <= d; i++){
		cin >> h[i];
	}
	int s[205][4];
	for (int i = 0; i < n; i++){
		int aa, ab, ac;
		cin >> aa >> ab >> ac;
		s[i][1] = aa;
		s[i][2] = ab;
		s[i][0] = ac;
		
	}
	int dp[205][205] = { 0 };
	for (int i = 0; i < n; i++){
		if (s[i][1] <= h[1] && s[i][2] >= h[1]){
			for (int j = 0; j < n; j++){
				if (s[j][1] <= h[2] && s[j][2] >= h[2]){
					int a;
					if (s[i][0]>s[j][0]){
						a = s[i][0] - s[j][0];
					}
					else{
						a = s[j][0] - s[i][0];
					}
					if (dp[2][j] < a){
						dp[2][j] = a;
					}
				}

			}
		}
		
	}
	

	for (int i = 3; i <=d; i++){
		for (int j = 0; j < n; j++){
			if (s[j][1] <= h[i] && h[i] <= s[j][2]){
				int max = 0;
				for (int l = 0; l < n; l++){
					if (dp[i - 1][l] != 0){
						int ba;
						if (s[j][0]>s[l][0]){
							ba = dp[i - 1][l] + s[j][0] - s[l][0];
						}
						else{
							ba = dp[i - 1][l] + s[l][0] - s[j][0];
						}
						if (ba > max || max == 0){
							max = ba;
						}
					}

				}
				dp[i][j] = max;
			}
			
		}
		
	}
	int max2 = 0;
	for (int i = 0; i < n; i++){
		if (max2 < dp[d][i] || max2 == 0){
			max2 = dp[d][i];
		}
	}
	cout << max2 << endl;
	return 0;
}

Measured memory_bytes: 3252
#include<stdio.h>
#define MAX 100
#define INFTY (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2
 
int n,T[MAX][MAX];
 
void dijkstra(){
  int minv,i,v,u;
  int d[MAX],color[MAX];
 
  for(i=0;i<n;i++){
    d[i] = INFTY;
    color[i] = WHITE;
  }
 
  d[0] = 0;
  color[0] = GRAY;
  
  while(1){
    minv = INFTY;
    u = -1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }
    
    if(u == -1)break;
    color[u] = BLACK;
    
    for(v=0;v<n;v++){
      if(color[v] != BLACK && T[u][v] != INFTY){
	if(d[v]>d[u]+T[u][v]){
	  d[v] = d[u] + T[u][v];
	  color[v] = GRAY;
	}
      }
    }
  }
  
  for(i=0;i<n;i++){
    printf("%d",i);
    printf(" ");
    d[i]= (d[i] == INFTY) ? -1 : d[i];
    printf("%d\n",d[i]);
  }
}
 
int main(){
  int i,j,k,c,u,v;
 
  scanf("%d",&n);
  
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      T[i][j] = INFTY;
    }
  }
  
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      T[u][v] = c;
    }
  }
  
  dijkstra();
 
  return 0;
}

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

int main() {

  int n, d;
  cin >> n >> d;
  
  int c = 0;
  REP(i,n) {
    double x, y;
    cin >> x >> y;
    double z = pow(x,2)+pow(y,2);
    if (pow(z,0.5) <= d) c++;
  }
  
  cout << c << endl;
  
  
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)


int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(max(10*a+b+c,10*b+a+c),10*c+a+b) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

//Triangle and Circle
public class Main{

	public static class Point {
		public double x;
		public double y;
		public Point(double x_, double y_) {
			x = x_; y=y_;
		}
	}
	public static class Line {
		public Point s,t;
		public Line(Point s_, Point t_) {
			s = s_; t = t_;
		}
	}
	public static double distanceSP(Line s, Point p) {
		Point r = proj(s, p);
		if (intersectSP(s, r)) return norm(sub(r, p));
		return Math.min(norm(sub(s.s, p)), norm(sub(s.t, p)));
	}
	public static boolean intersectSP(Line s, Point p) {
		return ccw(s.s, s.t, p) == 0;
	}
	public static int ccw(Point a, Point b, Point c) {
		Point p = sub(b, a);
		Point q = sub(c, a);
		if(extp(p, q) > EPS) return 1;		// counter clockwise
		if(extp(p, q) < -EPS)return -1;		// clockwise
		if(inp(p, q) < -EPS) return 2;		// c--a--b on line
		if(Math.abs(norm(p) - norm(q)) < EPS) return -2;	// a--b--c on line
		return 0;				// a--c--b(or a--c=b) on line 
	}
	public static Point sub(Point p1, Point p2) {
		return new Point(p1.x-p2.x, p1.y-p2.y);
	}
	public static Point proj(Line l, Point p) {
		double t = inp(sub(p, l.s), sub(l.s, l.t)) / Math.pow(norm(sub(l.s, l.t)),2);
		Point tp = sub(l.s, l.t);
		return new Point(l.s.x + t*tp.x, l.s.y + t*tp.y);
	}
	public static double inp(Point p1, Point p2) {
		return p1.x*p2.x + p1.y*p2.y;
	}
	public static double extp(Point p1, Point p2) {
		return p1.x*p2.y - p2.x*p1.y;
	}
	public static final double EPS = 1.0e-8;
	public static double norm(Point p) {
		return Math.hypot(p.x, p.y);
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			Point pp = new Point(sc.nextDouble(), sc.nextDouble());
			if(pp.x==0&&pp.y==0)break;
			Point[] p = new Point[3];
			p[0]=pp;
			for(int i=1;i<3;i++)p[i]=new Point(sc.nextDouble(),sc.nextDouble());
			Point c = new Point(sc.nextDouble(),sc.nextDouble());
			double r = sc.nextDouble();
			boolean isB = true;
			for(int i=0;i<3;i++){
				if(!(Math.pow(c.x-p[i].x, 2)+Math.pow(c.y-p[i].y, 2)<=r*r))isB = false;
			}
			if(isB){
				System.out.println("b");continue;
			}
			boolean left = true;
			boolean right = true;
			double min = Integer.MAX_VALUE;
			double max = 0;
			for(int i=0;i<3;i++){
				double ex = extp(sub(p[(i+1)%3], p[i]), sub(c, p[i]));
				if(ex < 0)left = false;
				else if(ex > 0)right = false;
				Line l = new Line(p[i], p[(i+1)%3]);
				//tü«Ìüªàl¦È¢ÆÊçÈ¢ AOJ0129QÆ
				Line m = new Line(p[(i+1)%3], p[i]);
				double d = Math.max(distanceSP(l, c), distanceSP(m, c));
				min = Math.min(min, d);
				max = Math.max(max, d);
			}
			boolean in = left|right;
			if(in && min >= r)System.out.println("a");
			else if(!in && min > r)System.out.println("d");
			else System.out.println("c");
		}
	}
}

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

typedef long long ll;
#define INF 0x3f3f3f3f3f3f3f3f
#define MOD 998244353
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
const double pi = acos(-1.0);

char s[200010];
int n;
int ans;
int val[200010]; // val[i]表示以 i为循环节长度的方案数
vector<int>divs; // 所有 2n/2divs[idx] 为奇数


// 以 s[0..len-1]为 循环节 [正][取反][正]这样产生的长n的字符串的 方案数
ll cnt(int len) {
  int ans = 0;
  rep(i,0,len){
    ((ans*=2)+=s[i]-'0')%=MOD;
  }
  // [0.........................n]
  // [0...len][反0...len][0...len]
  // s>=t ans+1
  // t>s ans+1
  // 因为统计了全零所以+1, 如果t比s大那么[0..len]作为循环节不行,把 [0..len] 值减1可行 所以 全零+1,再-1就是ans
  rep(i,0,n){
    char ti = ((s[i%len]-'0')^((i/len)%2))+'0';
    if (s[i] > ti) return ans + 1;
    if (ti > s[i]) return ans;
  }
  return ans + 1;
}

int main() {
  cin>>n;
  scanf("%s", s);
  rep(i,1,n+1){
    if (n % i == 0 && (n / i) % 2 == 1){
      divs.pb(i);
    }
  }
  ll ans = cnt(n) * (2 * n) % MOD; // 全部都是2n 次
  per(idx,0,divs.size()){
    int i = divs[idx];
    val[i] = (2*i-2*n) % MOD;
    rep(j,idx+1,divs.size()){
      if(divs[j] % divs[idx] == 0){
        (val[i]-=val[divs[j]])%=MOD;
      }
    }
    (ans += cnt(i) * val[i] )%=MOD;
  }
  cout<<(ans+MOD)%MOD<<endl;
  return 0;
}


Measured memory_bytes: 512
function main(input){
  input = input.split('');
  var egg = input[0];
  var meat = input[1];
  var veg = input[2];
  var ndl = 700;
  if(egg === 'o'){
    ndl += 100
  }
  if(meat === 'o'){
    ndl += 100
  }
  if(veg === 'o'){
    ndl += 100
  }
  console.log(ndl);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
// const ll INF = 1000000000000000000LL;
  
int main() {
    string s;
    cin >> s;
    if(s[s.size()-1]=='s'){
        s+="es";
    }
    else
        s+='s';
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <queue>
#include <algorithm>
#include <tuple>

using namespace std;

int main(void)
{
	int h, w;
	cin >> h >> w;
	string s[1000];
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	queue<tuple<int, int, int>> q;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '#') {
				q.push(make_tuple(i, j, 0));
			}
		}
	}

	int a[1000][1000];
	while (!q.empty()) {
		tuple<int, int, int> t = q.front();
		q.pop();
		a[get<0>(t)][get<1>(t)] = get<2>(t);

		int dx[] = { 0, 0, -1, 1 };
		int dy[] = { -1, 1, 0, 0 };
		for (int i = 0; i < 4; i++) {
			int nx = get<0>(t) + dx[i];
			int ny = get<1>(t) + dy[i];

			if (nx < 0) continue;
			if (nx >= h)continue;
			if (ny < 0)continue;
			if (ny >= w)continue;
			if (s[nx][ny] == '#')continue;
			s[nx][ny] = '#';
			q.push(make_tuple(nx, ny, get<2>(t) + 1));
		}
	}

	int mx = 0;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			mx = max(mx, a[i][j]);
		}
	}
	cout << mx << endl;

	return 0;
}

Measured memory_bytes: 21044