akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		int n = readNum();
		int k = readNum();
		int ans = 1;
		while (n > 0) {
			int a = ans * 2;
			int b = ans + k;
			ans = min(a, b);
			n--;
		}
		pln(ans);
	}

	int min(int a, int b) {
		return (a < b) ? a : b;
	}

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}


Measured memory_bytes: 21076
n=int(input())
a=[list(map(int,input().split())) for i in range(n)]
l=1000
r=1000
tmp=1
for i in range(n):
    if (a[i][0]>=l and a[i][1]>=r) or i == 0:
        tmp=sum(a[i])
        seki=1
    else:
        if l/a[i][0] > r/a[i][1]:
            seki=-1*(-1*l//a[i][0])
            tmp=sum(a[i])*seki
        else:
            seki=-1*(-1*r//a[i][1])
            tmp=sum(a[i])*seki
    l,r=[a[i][0]*seki,a[i][1]*seki]
print(tmp)


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

int main()
{
    int n;cin>>n;
    int ans=0;
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        char ch;cin>>ch;
        if(ch=='I')cnt++;
        else cnt--;
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,cap,sum=0,ans=0;
    cin>>n>>cap;
    ll w[n+1],v[n+1];
    for(ll i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
        sum+=v[i];
    }
    ll dp[n+1][sum+1],i,j;
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=sum;j++)
        {
            if(i==0&&j==0)
            {
                dp[i][j]=0;continue;
            }
            if(i==0)
            {
                dp[i][j]=INT_MAX;
            }
            else
            {
                ll inc=INT_MAX,exc;
                exc=dp[i-1][j];
                if(j-v[i]>=0)
                    inc=dp[i-1][j-v[i]]+w[i];
                dp[i][j]=min(inc,exc);
            }
            if(dp[i][j]<=cap)
            {
                ans=max(ans,j);
            }
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 79104
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
//import java.util.Scanner;

public class Main {

//	public static void main(String[] args) {
	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
//		Scanner sc = new Scanner(System.in);
//		int n= sc.nextInt();
//		sc.nextLine();
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);

		int n = Integer.parseInt( br.readLine() );

		DoublyLL ll = new DoublyLL();

		for (int i=0; i < n; i++) {
//			String command = sc.nextLine();
			String command = br.readLine();

			switch (command) {
			case "deleteFirst":
				ll.deleteFirst();
				continue;
			case "deleteLast":
				ll.deleteLast();
				continue;
			}

//			int x = Integer.parseInt(command.split(" ")[1]);

			switch (command.split(" ")[0]) {
			case "insert":
				ll.insert(Integer.parseInt(command.split(" ")[1]));
				continue;
			case "delete":
				ll.delete(Integer.parseInt(command.split(" ")[1]));
				continue;
			}
		}

		StringBuilder sb = new StringBuilder();

		DoublyLL.Element e = ll.fal.next;
		if ( e != ll.fal)
			sb.append(e.key);
		e = e.next;
		while (e != ll.fal) {
			sb.append(" " + e.key);
			e = e.next;
		}
		System.out.println(sb);
	}

}

class DoublyLL {

	class Element {
		Element previous;

		int key;

		Element next;

		Element(Element previous, int key, Element next) {
			this.key = key;
			this.next = next;
			this.previous = previous;
		}
	}

	// dammy first and last element
	// fal <-> element_1 <-> element_2 <-> ... <-> element_n <-> fal
	Element fal;

	Element newfirst;
	Element temp;

	// constructor
	DoublyLL() {
		fal = new Element(null, 0, null);
		fal.previous = fal;
		fal.next = fal;
	}

	// insert x
	void insert(int x) {
//		Element newfirst = new Element(fal, x, fal.next);
		newfirst = new Element(fal, x, fal.next);
		fal.next.previous = newfirst;
		fal.next = newfirst;
	}

	// delete x
	void delete(int x) {
//		Element temp = fal.next;
		temp = fal.next;

		while (temp != fal) {
			if (temp.key == x) {
				temp.previous.next = temp.next;
				temp.next.previous = temp.previous;
				break;
			}
			temp = temp.next;
		}

	}

	void deleteFirst() {
		// temp : first element of this list
		Element temp = fal.next;
		temp = fal.next;
		fal.next = temp.next;
		temp.next.previous = fal;
	}

	void deleteLast() {
		// temp : last element of this list
//		Element temp = fal.previous;
		temp = fal.previous;
		temp.previous.next = fal;
		fal.previous = temp.previous;
	}
}

Measured memory_bytes: 315188
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
const int INF = 1e9;

vector<int> G[100010];
pair<int, int> mem[100010];

void dfs(int v, int p){
  int l, r;
  tie(l, r) = mem[v];

  for(int u : G[v])if(u != p){
    dfs(u, v);

    int a, b;
    tie(a, b) = mem[u];

    --a, ++b;

    if (a <= -INF) continue;
    if (l <= -INF) {
      l = a, r = b;
      continue;
    }

    if (l % 2 != a % 2) throw 1;

    l = max(l, a);
    r = min(r, b);
    if (l > r) throw 1;
  }

  mem[v] = make_pair(l, r);
}

int res[100010];

void fill(int v, int p){
  int l, r;
  tie(l, r) = mem[v];

  if (p < 0) {
    res[v] = l;
  } else {
    if (l <= res[p] + 1 && res[p] + 1 <= r) {
      res[v] = res[p] + 1;
    } else {
      res[v] = res[p] - 1;
    }
  }

  for(int u : G[v])if(u != p){
    fill(u, v);
  }
}

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

  for(int i=0;i<N-1;i++){
    int u, v;
    cin >> u >> v;

    --u; --v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for(int i=0;i<N;i++){
    mem[i] = make_pair(-INF, INF);
  }

  int K;
  cin >> K;

  for(int i=0;i<K;i++){
    int v, p;
    cin >> v >> p;
    mem[v-1] = make_pair(p, p);
  }

  try {
    dfs(0, -1);
  } catch (int e) {
    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  fill(0, -1); 
  for(int i=0;i<N;i++)cout << res[i] << endl;
  
  return 0;
}


Measured memory_bytes: 15360
use proconio::input;

#[allow(unused_variables)]
fn main() {
    input! {
      a: String, b: String
    };

    let n: f32 = format!("{}{}", a, b).parse().unwrap();

    let i = n.sqrt().floor();

    println!("{}", if i * i == n { "Yes" } else { "No" });
}


Measured memory_bytes: 2624
#include <stdio.h>

int main(void)
{
	int a[10000],i,c=0;
	for (i = 0; i < 10000; i++){
		scanf("%d",&a[i]);
		if (a[i] == 0){
			break;
		}
		c++;
	}
	for (i = 0; i < c; i++){
		printf("Case %d: %d\n",i+1,a[i]);
	}
	return 0;
}

Measured memory_bytes: 1756
#include<cstdio>
#include<iostream>
int n,m=1,a[10000000],x[50];
long long ans;
void ins(int nc){
	for(int i=1;i<=21;i++){
		x[i]+=nc&1;
		nc=nc/2;
	}
}
void del(int nc){
	for(int i=1;i<=21;i++){
		x[i]-=nc&1;
		nc=nc/2;
	}
}
bool check(int nc){
	for(int i=1;i<=21;i++){
		if(x[i]==1&&(nc&1)==1) return false;
		nc=nc/2;
	}
	return true;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	ins(a[1]);
	for(int i=1;i<=n;i++){
		while(m<n&&check(a[m+1])) ins(a[++m]);
		ans+=m-i+1;
		del(a[i]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		String op = sc.next();
		int B = sc.nextInt();
		if(op.equals("+")){
			System.out.println(A + B);
		}else{
			System.out.println(A - B);
		}
	}
}

Measured memory_bytes: 23892
#include <cstdio>
#include <algorithm>
using namespace std;

struct POINT
{
	int x;
	int y;
};

POINT S[1000];
POINT T[5000];
int m;
int n;

bool cmp(POINT A, POINT B)
{
	if (A.x == B.x){
		return (A.y < B.y);
	}
	
	return (A.x < B.x);
}

bool Search(int x, int y)
{
	int i = 0;
	int j = 0;
	
//	printf("____%d %d\n", x, y);
	
	while (1){
//		printf("_%d %d\n", i, j);
		
		if (i == m){
			return true;
		}
		
		if (j == n){
			return false;
		}
		
//		printf("%d %d\n", S[i].x + x, T[j].x);
//		if (S[i].x + x > T[j].x){
//			return false;
//		}
		
		if (S[i].x + x == T[j].x && S[i].y + y == T[j].y){
			i++;
		}
		
		j++;
	}
}

int main()
{
	while (scanf("%d", &m), m){
		for (int i = 0; i < m; i++){
			scanf("%d %d", &S[i].x, &S[i].y);
		}
		
		scanf("%d", &n);
		for (int i = 0; i < n; i++){
			scanf("%d %d", &T[i].x, &T[i].y);
		}
		
		sort(S, S + m, cmp);
		sort(T, T + n, cmp);
		
		bool f;
		POINT dif;
		for (int i = 0; i < n; i++){
			f = Search(T[i].x - S[0].x, T[i].y - S[0].y);
			if (f){
				dif.x = T[i].x - S[0].x;
				dif.y = T[i].y - S[0].y;
				break;
			}
		}
		
		printf("%d %d\n", dif.x, dif.y);
	}
	
	
	return 0;
}

Measured memory_bytes: 1056
#!/usr/bin/env python3
#ABC69 D

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

h,w = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))

ans = [[None]*w for _ in range(h)]
for i in range(h):
    if i % 2:
        for j in range(w)[::-1]:
            for k in range(n):
                if a[k] > 0:
                    ans[i][j] = k+1
                    a[k] -= 1
                    break
    else:
        for j in range(w):
            for k in range(n):
                if a[k] > 0:
                    ans[i][j] = k+1
                    a[k] -= 1
                    break
for i in range(h):
    print(*ans[i])


Measured memory_bytes: 43740
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int dp[1 << 16][16];

int main(void)
{
	int n;
	while (cin >> n, n)
	{
		vector<vector<int>>t;
		for (int i = 0; i < n; ++i)
		{
			vector<int>tt;
			for (int j = 0; j <= n; ++j)
			{
				int ttt;
				cin >> ttt;
				tt.push_back(ttt);
			}
			t.push_back(tt);
		}
		memset(dp, 0x7f, sizeof(dp));
		for (int i = 0; i < n; ++i)
		{
			dp[0][i] = t[i][0];
		}
		for (int s = 1; s < (1 << n); ++s)
		{
			for (int i = 0; i < n; ++i)
			{
				if (s & (1 << i))continue;
				int res = INT_MAX;
				for (int j = 0; j < n; ++j)
				{
					if (!(s & (1 << j)))continue;
					int cost = t[i][0];
					for (int k = 0; k < n; ++k)
					{
						if (s & (1 << k))
						{
							cost = min(cost, t[i][k + 1]);
						}
					}
					res = min(res, dp[s - (1 << j)][j] + cost);
				}
				dp[s][i] = res;
			}
		}
		int ans = INT_MAX;
		for (int ls = 0; ls < n; ++ls)
		{
			int can = dp[(1 << n) - 1 - (1 << ls)][ls];
			ans = min(can, ans);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 7244
// 2010/12/29 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int c, n, m, s, d;
		cin >> c >> n >> m >> s >> d;
		if(c==0&&n==0&&m==0&&s==0&&d==0)
			break;

		int wgt[102][102];
		int hlf[102][102];
		for(int i=1; i<=n; i++)
			for(int j=1; j<=n; j++)
				if(i==j){
					wgt[i][j] = 0;
					hlf[i][j] = 20000;
				}
				else{
					wgt[i][j] = 20000;
					hlf[i][j] = 20000;
				}

		for(int i=0; i<m; i++){
			int a, b, f;
			cin >> a >> b >> f;
			wgt[a][b] = f;
			wgt[b][a] = f;
			hlf[a][b] = f/2;
			hlf[b][a] = f/2;
		}

		int djk[12][102];
		bool flg[12][102];
		for(int j=c; j>=0; j--)
			for(int i=1; i<=n; i++){
				djk[j][i] = 2000000;
				flg[j][i] = false;
			}
		djk[c][s] = 0;

		while(true){
			int j_min;
			int i_min;
			int w_min = 2000000;
			for(int j=0; j<=c; j++)
				for(int i=1; i<=n; i++)
					if((!flg[j][i])&&(djk[j][i]<w_min)){
						j_min = j;
						i_min = i;
						w_min = djk[j][i];
					}

			flg[j_min][i_min] = true;
			if(i_min==d){
				cout << djk[j_min][i_min] << endl;
				break;
			}

			for(int i=1; i<=n; i++)
				if(!flg[j_min][i])
					if(wgt[i_min][i]!=20000)
						if(djk[j_min][i]>djk[j_min][i_min]+wgt[i_min][i])
							djk[j_min][i] = djk[j_min][i_min]+wgt[i_min][i];
			if(j_min!=0)
				for(int i=1; i<=n; i++)
					if(!flg[j_min-1][i])
						if(hlf[i_min][i]!=20000)
							if(djk[j_min-1][i]>djk[j_min][i_min]+hlf[i_min][i])
								djk[j_min-1][i] = djk[j_min][i_min]+hlf[i_min][i];
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << fixed << setprecision(6) << (double)w * h / 2.0 << ' ' << (x * 2 == w && y * 2 == h) << endl;
}

Measured memory_bytes: 256
# coding: utf-8
n, x = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
for i in range(n-1):
    s = A[i+1] + A[i]
    if s > x:
        if A[i+1] >= s-x:
            A[i+1] -= (s-x)
        else:
            t = s-x-A[i+1]
            A[i+1] = 0
            A[i] -= t
print(S - sum(A))

Measured memory_bytes: 85128
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root,NIL;


void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while( x != NIL ){
    y = x;
    if ( z->key < x->key ){
      x = x->left;
    } else {
      x = x->right;
    }
  }

  z->parent = y;
  if ( y == NIL ){
    root = z;
  } else {
    if (z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node u){
  if (u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if (u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( strcmp(com, "insert") == 0 ){
      scanf("%d", &x);
      insert(x);
    } else if ( strcmp(com, "print") == 0 ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}




Measured memory_bytes: 25148
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define debug(a) cout << #a ": " << a << endl
using namespace std;
typedef long long ll;
const int mod = 998244353;
const int N = 2e5 + 7;
ll fac[N], finv[N];
ll ksm(ll x, ll y){
    ll ans = 1;
    while (y){
        if (y&1) ans = ans*x%mod;
        x = x*x%mod;
        y >>= 1;
    }
    return ans;
}
void init(void){
    for (int i = fac[0] = 1; i < N; ++i) fac[i] = fac[i-1]*i%mod;
    finv[N-1] = ksm(fac[N-1], mod-2);
    for (int i = N-2; i >= 0; --i){
        finv[i] = finv[i+1]*(i+1)%mod;
    }
}
ll C(int n, int m){
    return fac[n]*finv[m]%mod*finv[n-m]%mod;
}
void test(){
    while (1){
        int n, m; cin >> n >> m;
        cout << C(n, m) << endl;
    }
}
int main(void){ 
    IOS;
    init();
    //test();
    int n, m, k;
    cin >> n >> m >> k;
    ll ans = 0;
    for (int i = 0; i <= k; ++i){
        ans = (ans+C(n-1, i)*m%mod*ksm(m-1, n-i-1)%mod)%mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6800
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll dp[100007];
int main(){
  ll n,k;
  cin >> n >> k;
  vi h(n+1);
  h[0] = 0;
  for(ll i=1;i<=n;i++){
    cin >> h[i];
  }
  dp[0] = 0;
  dp[1] = 0;
  dp[2] = abs(h[2] - h[1]);
  for (ll i = 3; i <= n;i++){
    ll mini = INF;
    ll a=0;
    for (ll j = i-k; j < i; j++){
      if(j<=0){
        continue;
      }
      a = dp[j] + abs(h[i] - h[j]);
      chmin(mini, a);
    }
    dp[i] = mini;
  }
    print(dp[n]);
}


Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>

using namespace std;

long long int GCD(long long int a, long long int b) { return b ? GCD(b, a%b) : a; }

long long int func(long long int x, long long int c, long long int d) {
  long long int y = c * d / GCD(c, d);
  return (long long int)(x / c) + (long long int)(x / d) - (long long int) (x / y);
}

int main() {
    long long int a, b, c, d;

    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);

    printf("%lld\n", b - a + 1  - (func(b, c, d) - func(a-1, c, d)) );
    return 0;
}


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

int main(){

int S,h,m,s;
cin>>S;

h=S/3600;
if(h) S%=h*3600;
m=S/60;
if(m) S%=m*60;
s=S;

cout << h <<":"<< m <<":"<< s <<endl;

return 0;
}


Measured memory_bytes: 3136
fun main(arg: Array<String>) {
    var S = next()
    val K = listOf("dream", "dreamer", "erase", "eraser")
    while (true) {
        if (S.length == 0) return println("YES")
        var f = false
        for (n in K.indices)
            if (S.endsWith(K[n])) {
                S = S.substring(0, S.length - K[n].length)
                f = true
                break
            }
        if (!f) break
    }
    println("NO")
}

fun next() = readLine()!!


Measured memory_bytes: 118956
#include<stdio.h>
int main(){
  int n,q;
  int S[10000];
  int T[500];
  int i,j;
  int count=0;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  
  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf("%d",&T[j]);
  }
  
  for(j=0;j<q;j++){
    for(i=0;i<n;i++){
      if(S[i]==T[j]){ count++; break;
      }  
    }
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
signed main() {
	char a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a == b || b == c || c == d)puts("Bad");
	else puts("Good");
	ggr
}



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

int main(){
	#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
	    freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    freopen("output.txt", "w", stdout);
	#endif

	int n, ac=0, wa=0, tle=0, re=0;
	string bro;
	string acs="AC", was="WA", tles="TLE", res="RE";

	cin >> n;

	for(int i=0;i<=n;i++){
		getline(cin,bro);
		if(bro==acs){
			ac++;
		}
		else if(bro==was){
			wa++;
		}
		else if(bro==tles){
			tle++;
		}
		else if(bro==res){
			re++;
		}
	}

	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;

	return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    int sa = b-a;
    int num[1001];
    num[0] = 1;
    for(int i = 1;i < 1001;i++){
        num[i] = (i+1) + num[i-1];
    }
    int out = num[sa-1] - b;
    cout << out << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
int main() {
  ll a, b;
  cin >> a >> b;
  if(a * b <= 0) {
    cout << "Zero" << endl;
    return 0;
  }
  if(a > 0 && b > 0) {
    cout << "Positive" << endl;
    return 0;
  }
  if(abs(b - a) % 2 == 1) {
    cout << "Positive" << endl;
    return 0;
  } else {
    cout << "Negative" << endl;
    return 0;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define len(x) (int) (x.size())
using namespace std;
typedef long long ll;

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

    int total = 1, cont = 0;
    while (total < B) {
        total += A-1;
        cont++;
    }
    cout << cont << '\n';
    return 0;
}

Measured memory_bytes: 256
N,K = map(int, input().split())
L = list(map(int, input().split()))
L = sorted(L)
num = L[0]
i = 0
if sum(L) > K:
    while num <= K:
        i += 1
        num += L[i]
    print(i)
elif sum(L) == K:
    print(N)
else:print(N-1)
    

Measured memory_bytes: 3060
# coding: utf-8
# Your code here!
n = int(input())
s = list(map(int,input().split()))
ans = {}
#各番号がいくつずつあるのかを整理
#keyに番号、valueにその番号が書かれてあるボールの数
for i in range(n):
    if not s[i] in ans:
        ans[s[i]] = 1
    else:
        ans[s[i]] += 1
#iC2の総和
answer = 0
for i,j in ans.items():
    answer += j*(j-1)//2
#answer-nC2+(n-1)C2 = answer-n+1
#nはans[s[i]],よって以下の出力で求められる
for i in range(n):
    print(answer-ans[s[i]]+1)


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

int main()
{
    ll i,n,c=0;
    cin>>n;
    ll a1[n];
    set<ll> s;

    for(i = 0; i < n; i++)
    {
        cin>>a1[i];
        s.insert(a1[i]);
    }
    if(s.size()!=n)
        cout<<"NO\n";
    else
        cout<<"YES\n";
}


Measured memory_bytes: 11136
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() { return ReadLine().Split().Select(int.Parse).ToList(); }

        static int N;
        static int[] A;
        static int[] B;
        static int[] C;
        static int[,] dp;
        static void Main(string[] args)
        {
            N = Slist()[0];
            A = new int[N + 1];
            B = new int[N + 1];
            C = new int[N + 1];
            dp = new int[N + 1, 3];

            for (var i = 1; i <= N; ++i)
            {
                var t = Sarray();
                A[i] = t[0];
                B[i] = t[1];
                C[i] = t[2];
            }
            for (var i = 0; i < N; ++i)
            {
                dp[i + 1, 0] = Max(dp[i, 1], dp[i, 2]) + A[i + 1];
                dp[i + 1, 1] = Max(dp[i, 2], dp[i, 0]) + B[i + 1];
                dp[i + 1, 2] = Max(dp[i, 0], dp[i, 1]) + C[i + 1];
            }
            WriteLine(Max(dp[N, 0], Max(dp[N, 1], dp[N, 2])));
        }
    }
}


Measured memory_bytes: 19884
c = []
for i in range(3):
    c.append(list(map(int, input().split())))

ans = True
for i in range(2):
    tmp = c[0][i + 1] - c[0][i]
    for j in range(2):
        if c[j + 1][i + 1] - c[j + 1][i] != tmp:
            ans = False
            break

for i in range(2):
    tmp = c[i + 1][0] - c[i][0]
    for j in range(2):
        if c[i + 1][j + 1] - c[i][j + 1] != tmp:
            ans = False
            break

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


Measured memory_bytes: 9212
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.stream.LongStream;

public class Main {

    public static void main(String[] args) throws NumberFormatException, IOException {
        Stdin stdin = new Stdin();
        int n = stdin.nextInt();
        int m = stdin.nextInt();
        int[] s = new int[n];
        int[] t = new int[m];
        for (int i = 0; i < n; i++) s[i] = stdin.nextInt();
        for (int i = 0; i < m; i++) t[i] = stdin.nextInt();

        long mod = 1000000007L;
        long[][] dp = new long[n + 1][m + 1];
        long[][] sm = new long[n + 1][m + 1];
        dp[0][0] = 1;
        for (int i = 0; i <= n; i++) sm[i][0] = 1;
        for (int i = 0; i <= m; i++) sm[0][i] = 1;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                if (s[i - 1] == t[j - 1]) {
                    dp[i][j] = sm[i - 1][j - 1];
                }

                // sm[i][j] = (sm[i - 1][j] + sm[i][j - 1] - sm[i - 1][j - 1] + dp[i][j]) % mod;
                sm[i][j] = LongStream.of(sm[i - 1][j], sm[i][j - 1], -1 * sm[i - 1][j - 1], dp[i][j])
                                     .mapToObj(BigInteger::valueOf)
                                     .reduce(BigInteger.ZERO, (x, y) -> x.add(y))
                                     .mod(BigInteger.valueOf(mod))
                                     .longValue();


            }
        }
        System.out.println(sm[n][m]);
    }

    private static final class Stdin {
        private BufferedReader stdin;
        private ArrayDeque<String> tokens;

        public Stdin() {
            this.stdin = new BufferedReader(new InputStreamReader(System.in));
            this.tokens = new ArrayDeque<>();
        }

        public String nextToken() throws IOException {
            if (tokens.isEmpty()) {
                for (String token : stdin.readLine().split(" ")) {
                    tokens.add(token);
                }
            }
            return tokens.poll();
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(nextToken());
        }

        public int nextLong() throws NumberFormatException, IOException {
            return Integer.parseInt(nextToken());
        }
    }
}

Measured memory_bytes: 385304
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
queue<long long> que;
int main(){
	int k;
	cin >> k;
	for (int i = 1; i < 10; i++) {
		que.push(i);
	}
	for (int i = 0; i < k - 1; i++) {
		long long o = que.front();
		if (o % 10 != 0) {
			que.push(o * 10 + o % 10 - 1);
		}
		que.push(o * 10 + o % 10);
		if (o % 10 != 9) {
			que.push(o * 10 + o % 10 + 1);
		}
		que.pop();
	}
	cout << que.front() << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    int k;
    cin >> k;
    int c=min(a,b);
    vector<int> v;
    for ( int i = 1 ; i <= c ; i++ ){
        if ( a % i == 0 && b % i == 0 ){
            v.push_back(i);
        }
    }
    sort(v.rbegin(),v.rend());
    cout << v[k-1];
}

Measured memory_bytes: 256
s = input()
res_list = ['-', '-', '-']
for i in range(8):
    res = s[0]
    for j in range(3):
        if (i >> j) &1:
            res += '+'
        else:
            res += '-'
        res += s[j+1]
    if eval(res) == 7:
        print(res + '=7')
        exit()
    

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

vector<long long> calc_divisor(long long n) {
    vector<long long> res;
    for (long long i = 1LL; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            long long j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

long long solve(long long N) {
    auto div = calc_divisor(N);
    long long res = 0;
    for (auto r : div) {
        if (r > 1000000) continue;
        if (N > r*r + r) res += (N-r)/r;
    }
    return res;
}

int main() {
    long long N; cin >> N;
    cout << solve(N) << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cstring>

using namespace std;

int kei[6][2]={ {2,3},{3,2},{-1,4},{2,-1},{5,1},{1,3} };//A,B,X,Y,Z,W

main(){
  char s[128];
  while(cin >> s,strcmp(s,"#")!=0){
    int b=0;
    int cheak=0;
    int n=strlen(s);
    int k;
    for(int i=0;i<n;i++){
      if(s[i]=='0')k=0;
      else k=1;
      b=kei[b][k];
      if(b==-1){
	cheak=1;
	break;
      }
    }
    if(cheak==0 && b==1)cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

Measured memory_bytes: 1132
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    S = lines.pop(0)
    print(700 + 100 * len(list(filter( lambda x: x == 'o', list(S)))))

#
# main
#
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class T>
inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>
inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N,M,X; cin >> N >> M >> X;
    vc<vi> V(N,vi(M));
    int cost[N];
    rep(i,N){
        cin >> cost[i];
        rep(j,M){
            cin >> V[i][j];
        }
    }
    int ans=INF;
    rep(i,(1<<N)){
        int pos=0;
        vi A(M,0);
        rep(j,N) {
            if(i>>j & 1){
                pos+=cost[j];
                rep(k,M){
                    A[k]+=V[j][k];
                }
            }
        }
        bool can=true;
        rep(j,M) {
            if(A[j]<X) can=false;
        }
        if(can) chmin(ans,pos);
    }
    if(ans==INF) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3664
n, d = map(int,input().split())
xs = [list(map(int,input().split())) for i in range(n)]
ans = 0
for i in range(n):
  for j in range(n-i-1):
    a, b = xs[i], xs[i+j+1]
    tmp = 0
    for k in range(d): tmp += (a[k]- b[k])**2
    if (tmp**0.5)%1==0: ans+=1
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
using namespace std;

int main() {
	int H, W, N;

	cin >> H >> W >> N;

	int target;
	if (H > W) {
		target = H;
	} else {
		target = W;
	}

	int res = N / target;
	if (N % target != 0) {
		res++;
	}
	cout << res << endl;
}

Measured memory_bytes: 888
#include <stdio.h>

int main(){
    int i,x,y,tmp;
    for (i =1; ;){
        scanf("%d %d", &x, &y);
        if (x==0 && y==0){
            break;
        }
        else if (x > y){
            tmp = x;
            x = y;
            y = tmp;
        }
        printf("%d %d\n", x, y);
    }
    return(0);
}

Measured memory_bytes: 600
N = int(input())
count = 0
for i in range(1,N):
    q,mod = divmod(N,i)
    #ピッタリは外す
    if mod == 0:
        q -= 1
    if q-i >= 0:
        count += (q-i)*2 + 1
    else:
        break
print(count)


Measured memory_bytes: 8956
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;

int main(){

  string s,t,u;
  cin>>s>>t;
  int a,b;cin>>a>>b;
  cin>>u;
  if(u==s)cout<<a-1<<" "<<b<<endl;
  else cout<<a<<" "<<b-1<<endl;

  return 0;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
from collections import defaultdict
from heapq import heappush,heappop
from itertools import accumulate
N,m,s,t=map(int,input().split())
en=[set() for i in range(N+1)]
sneek=[set() for i in range(N+1)]
for i in range(m):
    u,v,a,b=map(int,input().split())
    en[u]|={(a,v)}
    en[v]|={(a,u)}
    sneek[u]|={(b,v)}
    sneek[v]|={(b,u)}
inf=float('inf')
def makedist(first,branch):
    dist=[inf]*(N+1)
    dist[first]=0
    check=[(0,first)]
    while len(check)>0:
        d,now=heappop(check)
        if dist[now]<d:
            continue
        for lenth,nex in branch[now]:
            if d+lenth<dist[nex]:
                dist[nex]=d+lenth
                heappush(check,(d+lenth,nex))
    return dist
disten=makedist(s,en)
distsneek=makedist(t,sneek)
ans=list(accumulate([y+s for y,s in zip(disten,distsneek)][::-1],min))
big=10**15
[print(big-ans[i]) for i in range(N-1,-1,-1)]
#https://atcoder.jp/contests/soundhound2018-summer-qual/submissions/4993088

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    string s; cin >> s;
    for (int i = 0; i < 8; i++) s.pop_back();
    cout << s << endl;
}

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

int main () {
    int n;
    scanf("%d", &n);
    int A[n];
    for (int a=0; a<n; a++)
        scanf("%d", &A[a]);

    int ans = 0;
    for (int a=0; a<n; a++)
        ans += A[a] -1;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char x[1000];
    int y = 0;
    int j = 0;
    int q, k;
    while(1){
        scanf("%c", &x[j]);
        if(x[0] == '0')
            break;
        if(x[j] == 10){
            for(q = 0; q < j; q++){
                y += (x[q] - '0');
            }
            printf("%d\n", y);
            j = 0;
            y = 0;
            continue;
        }
        j++;
    }
    
    return 0;
}


Measured memory_bytes: 2100
# 新しいvalueのほうが小さい場合のみ設定
def set_val(map, x, y, value):
    key = str(x) + " " + str(y)
    if key in map:
        if value < map[key]:
            map[key] = value
    else:
        map[key] = value
    return map


size_x, size_y = map(int, input().split())
count = size_x + size_y
temp_values = []

for i in range(size_x):
    temp_values.append(input())

values = []
for value in temp_values:
    values.append(list(value))

initial = 0
yet = True
all_same = True
if values[0][0] == "#":
    initial = 1

check_value = {"0 0": initial}
# 探索処理
for i in range(count):
    check_temp_value = {}
    for key in check_value.keys():
        x, y = map(int, key.split())
        value = check_value.get(key)
        # 下に移動
        if x + 1 <= size_x - 1:
            if values[x + 1][y] == "#" and values[x][y] == ".":
                # 異なる経路で同一座標に到達した場合、小さいほうの値を設定
                check_temp_value = set_val(check_temp_value, x + 1, y, value + 1)
                yet = False
                all_same = False
            else:
                check_temp_value = set_val(check_temp_value, x + 1, y, value)
        # 右に移動
        if y + 1 <= size_y - 1:
            if values[x][y + 1] == "#" and values[x][y] == ".":
                # 異なる経路で同一座標に到達した場合、小さいほうの値を設定
                check_temp_value = set_val(check_temp_value, x, y + 1, value + 1)
                yet = False
                all_same = False
            else:
                check_temp_value = set_val(check_temp_value, x, y + 1, value)
    check_value = check_temp_value
    if len(check_value) == 1:
        # ゴールについたら終了
        break
    yet = True

# すべて同じなら無条件に初期値
if all_same:
    print(initial)
else:
    # 最後が#なら加算
    result_val_add = 0
    if values[size_x - 1][size_y - 1] == "#" and yet :
        result_val_add = 1
    print(list(check_value.values())[0] + result_val_add)


Measured memory_bytes: 3188
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
#define EPS 1e-6
const double g=9.8;

int N,V,X,Y;
int L[51],B[51],R[51],T[51];

double calc(double vy,double t){
	return vy*t-g*t*t/2.0;
}

int cmp(double lb,double ub,double a){
	return a<lb+EPS? -1 : a>ub-EPS ? 1 : 0;
}

bool check(double qx,double qy){
	double a=g*g/4,b=g*qy-V*V,c=qx*qx+qy*qy;
	double D=b*b-4*a*c;
	if(D<0 && D>-EPS)D=0;
	if(D<0)return false;
	for(int d=-1;d<=1;d+=2){
		double t2=(-b+d*sqrt(D))/(2*a);
		if(t2<=0)continue;
		double t=sqrt(t2);
		double vx=qx/t,vy=(qy+g*t*t/2)/t;
		double yt=calc(vy,X/vx);
		if(yt<Y-EPS)continue;
		bool ok=true;
		for(int i=0;i<N;i++){
			if(L[i]>=X)continue;
			if(R[i]==X && Y<=T[i] && B[i]<=yt)ok=false;
			int yL=cmp(B[i],T[i],calc(vy,L[i]/vx));
			int yR=cmp(B[i],T[i],calc(vy,R[i]/vx));
			int xH=cmp(L[i],R[i],vx*(vy/g));
			int yH=cmp(B[i],T[i],calc(vy,vy/g));
			if(xH==0 && yH>=0 && yL<0)ok=false;
			if(yL*yR<=0)ok=false;
		}
		if(ok)return true;
	}
	return false;
}

void solve(){
	for(int i=0;i<N;i++){
		R[i]=min(R[i],X);
	}
	bool ok=check(X,Y);
	for(int i=0;i<N;i++){
		ok|=check(L[i],T[i]);
		ok|=check(R[i],T[i]);
	}
	puts(ok?"Yes":"No");
}

int main(void){
	scanf("%d %d %d %d",&N,&V,&X,&Y);
	for(int i=0;i<N;i++){
		scanf("%d%d%d%d",&L[i],&B[i],&R[i],&T[i]);
	}
	solve();
	return 0;
}

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

int t[100], h[100];
int main() {
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		int t_s = 0, h_s = 0;
		rep(i, n) {
			scanf("%d", &t[i]);
			t_s += t[i];
		}
		rep(i, m) {
			scanf("%d", &h[i]);
			h_s += h[i];
		}
		int s = t_s - h_s;
		int ta = INF, ha = INF;
		rep(i, n) {
			rep(j, m) {
				if ((t[i] - h[j]) * 2 == s&& t[i] + h[j] < ta + ha) {
					ta = t[i]; ha = h[j];
				}
			}
		}
		if (ta == INF) {
			puts("-1");
			continue;
		}
		printf("%d %d\n", ta, ha);
	}
}

Measured memory_bytes: 3136
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		for(int i=1;i<=9;i++){
			for(int j=1;j<=9;j++){
				if(N == i * j){
					Console.WriteLine("Yes");
					return;
				}
			}
		}
		Console.WriteLine("No");
		
	}
	int N;
	public Sol(){
		N = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 11092
A, B, C, X, Y = map(int, input().split())

d = X * A + Y * B
e = 2 * C * max(X, Y)
f = 2 * C * min(X, Y) + (X - min(X, Y)) * A + (Y - min(X, Y)) * B
print(min(d, e, f))

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


int main() {
  double pi=3.141592653589793;
  double a,b,h,m;
  cin >> a >>b >> h >>m;
  double hr=h*30+m*0.5,mr=m*6;//rad
  if(hr==0){hr+=360;}
  if(mr==0){mr+=360;}
  double alf=min(abs(mr-hr),abs(hr-mr))*pi/180;
  double ans=a*a+b*b-2*a*b*cos(alf);
  printf("%.12lf\n",sqrt(ans));
}

Measured memory_bytes: 4232
import std.stdio, std.string, std.conv, std.bigint, std.typecons, std.algorithm, std.array, std.math, std.range, std.functional;

void main() {
    auto tmp = readln.split.to!(int[]);
    writeln(max(0, min(tmp[3], tmp[1]) - max(tmp[2], tmp[0])));
}

Measured memory_bytes: 256
# D - Crossing
N = int(input())
k = 1

def list_print(S):
    print(len(S), end='')
    for i in range(len(S)):
        print(' {}'.format(S[i]), end='')
    print('')

while k<1000:
    if k*(k-1)//2==N:
        break
    k += 1
if k==1000:
    print('No')
else:
    S = [[] for _ in range(k)]
    i = 1
    for l in range(k):
        for r in range(l+1,k):
            S[l].append(i)
            S[r].append(i)
            i += 1
    print('Yes')
    print(k)
    for i in range(k):
        list_print(S[i])

Measured memory_bytes: 77780
n = int(input())
lst = []
for i in range(n):
  x, l = map(int, input().split())
  left = x - l
  right = x + l
  lst.append([left, right])

lst = sorted(lst, key=lambda x: x[1])

ans = 1
limit = lst[0][1]
for i in range(n):
  if lst[i][0] >= limit:
    ans += 1
    limit = lst[i][1]

print(ans)

Measured memory_bytes: 63576
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in a:
    while True:
        if i%2==0:
            cnt+=1
            i=i//2
        else:
            break
print(cnt)

Measured memory_bytes: 73044
#include<iostream>
#include<sstream>
#include<algorithm>
using namespace std;main(){string in;int n,ma,mi;cin>>n;while(n--){cin>>in;sort(in.begin(),in.end());istringstream x(in);x>>mi;sort(in.rbegin(),in.rend());istringstream y(in);y>>ma;cout<<ma-mi<<endl;}}

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

void solve() {
    cin >> S;
    int N = S.size();
    vector<int> a(N, 0);
    int i = 0;
    while(i < N - 1) {
        char cr = S[i];
        char cl = S[i+1];
        if (!(cr == 'R' && cl == 'L')) {
            i++;
            continue;
        }
        a[i]++; a[i+1]++;
        int ir = 1;
        while (S[i-ir] == 'R' && 0 <= i - ir) {
            if (ir % 2 == 0) a[i]++;
            else a[i+1]++;
            ir++;
        }
        int il = 1;
        while (S[i+1 + il] == 'L' && i+1+il < N) {
            if (il % 2 == 0) a[i+1]++;
            else a[i]++;
            il++;
        }
        i = i+1+il;
    }
    for (int i = 0; i < N; ++i) {
        printf("%d ", a[i]);
    }
    cout << endl;
}

int main() {
    solve();
    return 0;
}



Measured memory_bytes: 1024
import java.util.Scanner;
import java.math.BigDecimal;

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

		// 整数の入力
		String a = sc.next();
		String b = sc.next();
		
		int c = 0;
		
		for (int i = 0; i < a.length(); i++) {
			if (a.charAt(i) != b.charAt(i)) {
				c++;
			}
		}
		

		System.out.println(c);

	}
}

Measured memory_bytes: 41248
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb(n) push_back(n)
#define mp(n,m) make_pair(n, m)
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;



int main(){
	int n, m, t;
	string s;
	while(cin>>n && n){
		vector<string> v;
		vector<vector<int> > vv(100);
		rep(i, n){
			cin>>s>>m;
			v.pb(s);
			rep(j, m){
				cin>>t;
				vv[t].pb(i);
			}
		}
		vector<int> p(n, 0);
		for(int i = 0; i < 100; i++){
			for(int j = 0; j < vv[i].size(); j++){
				p[vv[i][j]]+=n-vv[i].size()+1;
			}
		}
		int idx = 0, m = INF;
		for(int i = 1; i < n; i++){
			if(p[idx]>p[i]){
				idx = i;
			}
			else if(p[idx]==p[i] && v[idx] > v[i]){
				idx = i;
			}
		}
		cout<<p[idx]<<" "<<v[idx]<<endl;
	}
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  int N, M;
  cin >> N >> M;
  vector<int> X(M);
  for(int i = 0; i < M; i++){
    cin >> X[i];
  }
  sort(X.begin(), X.end());
  vector<int> dif(M-1); 
  for(int i = 0; i < M-1; i++){
    dif[i] = X[i+1] - X[i];
  }
  sort(dif.begin(), dif.end());
  long long ans = 0;
  for(int i = 0; i < M-N; i++){
    ans += dif[i];
  }
  cout << ans <<endl;
}

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

public class Main {

    public static void main(String[] args) throws IOException {
        
        BufferedReader stdId = new BufferedReader(new InputStreamReader(System.in));
        String[] std = stdId.readLine().split(" ");
        
        int a = Integer.parseInt(std[0]);
        int b = Integer.parseInt(std[1]);
        
        int d = a/b;
        int r = a%b;
        double f = (double)a/(double)b;
        
        System.out.printf("%d %d %5f", d,r,f);
        
    }
}

Measured memory_bytes: 24836