akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

const int MAXN = 1000;
const int MAXM = 2000;
const int MOD = int(1E9) + 7;

int pw2[MAXM + 5];
void init() {
	pw2[0] = 1;
	for(int i=1;i<=MAXM;i++)
		pw2[i] = 2LL*pw2[i-1]%MOD;
}

struct edge{
	int u, v; ll w;
	friend bool operator < (const edge &a, const edge &b) {
		return a.w < b.w;
	}
}e[MAXM + 5], t[MAXM + 5];

ll G[MAXN + 5][MAXN + 5];

int fa[MAXN + 5];
vector<int>v[MAXN + 5];
int find(int x) {
	return (x == fa[x] ? x : find(fa[x]));
}
bool merge(int x, int y, ll w) {
	if( find(x) == find(y) ) return false;
	x = find(x), y = find(y);
	if( v[x].size() > v[y].size() ) swap(x, y);
	for(int i=0;i<v[x].size();i++)
		for(int j=0;j<v[y].size();j++)
			G[v[x][i]][v[y][j]] = G[v[y][j]][v[x][i]] = w;
	fa[x] = y;
	for(int i=0;i<v[x].size();i++)
		v[y].push_back(v[x][i]);
	return true;
}

int main() {
	init();
	int N, M; ll X;
	scanf("%d%d%lld", &N, &M, &X);
	for(int i=1;i<=M;i++)
		scanf("%d%d%lld", &e[i].u, &e[i].v, &e[i].w);
	sort(e + 1, e + M + 1);
	for(int i=1;i<=N;i++) fa[i] = i, v[i].push_back(i);
	ll A = 0; int cnt = 0;
	for(int i=1;i<=M;i++) {
		if( !merge(e[i].u, e[i].v, e[i].w) )
			t[++cnt] = e[i], t[cnt].w -= G[e[i].u][e[i].v];
		else A += e[i].w;
	}
	int ans = 0;
	if( A == X ) ans = (pw2[M] + MOD - pw2[M-N+1+1]) % MOD;
	sort(t + 1, t + cnt + 1);
	for(int i=1;i<=cnt;i++)
		if( A + t[i].w == X ) ans = (ans + pw2[cnt-i+1]) % MOD;
	printf("%d\n", ans);
}

Measured memory_bytes: 8192
N = int(input())
cnt = [[0]*10 for _ in range(10)]
for i in range(1, N+1):
  head = int(str(i)[0])
  tail = int(str(i)[-1])
  cnt[head][tail] += 1
ans = 0
for i in range(1, 10):
  for j in range(1, 10):
    ans += cnt[i][j]*cnt[j][i]
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}
static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

typedef struct directed_edge {
  int32_t vertex;
  int32_t next;
} graph_edge;

typedef struct directedGraph {
  graph_edge *edge;
  int32_t *start;
  int32_t pointer;
  int32_t vertex_num;
  int32_t edge_max_size;
} graph;

graph* new_graph (const int vertex_num) {
  graph *g = (graph *) calloc (1, sizeof (graph));
  g->edge = (graph_edge *) calloc (1, sizeof (graph_edge));
  g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));
  g->pointer = 0;
  g->vertex_num = vertex_num;
  g->edge_max_size = 1;
  for (int32_t i = 0; i < vertex_num; ++i) {
    g->start[i] = -1;
  }
  return g;
}

void add_edge (graph *g, int32_t from, int32_t to) {
  if (g->pointer == g->edge_max_size) {
    g->edge_max_size *= 2;
    g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size);
  }
  g->edge[g->pointer] = (graph_edge) {to, g->start[from]};
  g->start[from] = g->pointer++;
}

void BFS_graph (graph *g, int32_t src, int32_t *q) {
  uint8_t *used = (uint8_t *) calloc (g->vertex_num, sizeof (uint8_t));
  int32_t front = 0;
  int32_t last = 0;
  used[src] = 1;
  q[last++] = src;
  while (front < last) {
    const int32_t v = q[front++];
    for (int32_t p = g->start[v]; p != -1; p = g->edge[p].next) {
      const int32_t u = g->edge[p].vertex;
      if (!used[u]) {
	used[u] = 1;
	q[last++] = u;
      }
    }
  }
  free(used);
}

void run (void) {
  i32 n = read_int();
  graph *g = new_graph (n);
  for (i32 i = 1; i < n; ++i) {
    i32 a = read_int() - 1;
    i32 b = read_int() - 1;
    add_edge (g, a, b);
    add_edge (g, b, a);
  }
  const i32 m = 100000;
  i32 *cnt = (i32 *) calloc (m + 1, sizeof (i32));
  for (i32 i = 0; i < n; ++i) {
    cnt[read_int()]++;
  }
  i32 *q = (i32 *) calloc (n, sizeof (i32));
  BFS_graph (g, 0, q);
  i32 *ans = (i32 *) calloc (n, sizeof (i32));
  i32 sum = 0;
  i32 k = 1;
  for (i32 i = n - 1; i >= 0; --i) {
    for (; cnt[k] == 0; ++k);
    i32 v = q[i];
    ans[v] = k;
    cnt[k]--;
    if (i > 0) sum += k;
  }
  print_int (sum);
  putchar ('\n');
  for (i32 i = 0; i < n; ++i) {
    print_int (ans[i]);
    putchar (i == n - 1 ? '\n' : ' ');
  }
}

int main (void) {
  run();
  return 0;
}


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

int main(){
  int A[100],N,v,j;
  cin>>N;
  for(int i=0;i<N;i++)
    cin>>A[i];

  for(int i=0;i<N;i++){
    v=A[i];
    j=i-1;

    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    for(int i=0;i<N-1;i++)
      cout<<A[i]<<' ';
    cout<<A[N-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
import math

a, b, c = [float(line) for line in input().split()]
S = 1 / 2 * a * b * math.sin(math.radians(c))
c = math.sqrt((a ** 2) + (b ** 2) - (2 * a * b * math.cos(math.radians(c))))
L = a + b + c
H = S / (a * (1 / 2))

print(S, L, H)



Measured memory_bytes: 5708
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;

const int N = 2003;

char s[N][N];
int n, m, q, sump[N][N], suml0[N][N], suml1[N][N];

int main() {
	scanf("%d%d%d", &n, &m, &q);
	for (int i = 1; i <= n; ++i)
		scanf("%s", s[i] + 1);
	
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			if (s[i][j] == '1') sump[i][j] = 1;
	for (int i = 1; i <= n; ++i)
		for (int j = 2; j <= m; ++j)
			if (s[i][j] == '1' && s[i][j - 1] == '1') suml0[i][j] = 1;
	for (int i = 2; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			if (s[i][j] == '1' && s[i - 1][j] == '1') suml1[i][j] = 1;
	
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j) {
			sump[i][j] = sump[i][j] + sump[i - 1][j] + sump[i][j - 1] - sump[i - 1][j - 1];
			suml0[i][j] = suml0[i][j] + suml0[i - 1][j] + suml0[i][j - 1] - suml0[i - 1][j - 1];
			suml1[i][j] = suml1[i][j] + suml1[i - 1][j] + suml1[i][j - 1] - suml1[i - 1][j - 1];
		}
	
	int sp, sl, x1, y1, x2, y2;
	for (int i = 1; i <= q; ++i) {
		scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
		sp = sl = 0;
		sp = sump[x2][y2] - sump[x1 - 1][y2] - sump[x2][y1 - 1] + sump[x1 - 1][y1 - 1];
		sl = suml0[x2][y2] - suml0[x1 - 1][y2] - suml0[x2][y1] + suml0[x1 - 1][y1];
		sl += suml1[x2][y2] - suml1[x1][y2] - suml1[x2][y1 - 1] + suml1[x1][y1 - 1];
		printf("%d\n", sp - sl);
	}
	
	return 0;
}


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

using namespace std;

#define int long long
#define M 1000000007

int prime[1000010];
int cnt[1000010];

int gcd(int a,int b){
	if(b==0){
		return(a);
	}
	return(gcd(b,a%b));
}

signed main(){
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	prime[1]=1;
	for(int i=2;i<=1000000;i++){
		if(prime[i]==0){
			for(int j=i*2;j<=1000000;j+=i){
				prime[j]=1;
			}
		}
	}
	
	int n;
	cin >> n;
	int a[n];
	int all=-1;
	for(int i=0;i<n;i++){
		cin >> a[i];
		if(all==-1){
			all=a[i];
		}
		all=gcd(all,a[i]);
	}
	int flag=0;
	for(int i=0;i<n&&flag==0;i++){
		for(int j=1;j<=sqrt(a[i])&&flag==0;j++){
			if(a[i]%j==0){
				if(prime[j]==0){
					cnt[j]++;
					if(cnt[j]>1){
						flag=1;
					}
				}
				if(j!=a[i]/j&&prime[a[i]/j]==0){
					cnt[a[i]/j]++;
					if(cnt[a[i]/j]>1){
						flag=1;
					}
				}
			}
		}
	}
	if(flag==0){
		cout << "pairwise coprime" << endl;
	}
	else if(all==1){
		cout << "setwise coprime" << endl;
	}
	else{
		cout << "not coprime" << endl;
	}
} 

Measured memory_bytes: 19904
import heapq
n, m = [int(i) for i in input().split()]
lrc = []
for _ in range(m):
    l, r, c = [int(i) for i in input().split()]
    lrc.append([l-1, r-1, c])
lrc.sort()
a = []
j = 0
for i in range(n-1):
    new = []
    while j < m and lrc[j][0] == i:
        new.append(lrc[j])
        j += 1
    if i == 0:
        now = 0
    else:
        while True:
            if len(a) == 0:
                print(-1)
                exit()
            now = heapq.heappop(a)
            if now[1] >= i:
                heapq.heappush(a, now)
                break
        now = now[0]
    for k in new:
        heapq.heappush(a,[now + k[2], k[1]])


while True:
    if len(a) == 0:
        print(-1)
        exit()
    now = heapq.heappop(a)
    if now[1] >= n-1:
        heapq.heappush(a, now)
        break
now = now[0]
print(now)


Measured memory_bytes: 34752
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

int main() {
  i64 N;
  cin >> N;
  vector<string> s(N);
  vector<i64> t(N);
  rep(i,0,N) cin >> s[i] >> t[i];
  string X;
  cin >> X;
  bool A = false;
  i64 ans = 0;
  rep(i,0,N) {
    if(A) {
      ans += t[i];
    } 
    if(s[i] == X) {
      A = true;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
 
const int maxn = 2e5;
int n, a[maxn + 3];
 
bool check(int x) {
	for (int i = 0; i <= n - 1; i++) {
		if ((a[n - i] < x && a[n - i - 1] < x) || (a[n + i] < x && a[n + i + 1] < x)) {
			return false;
		}
		if ((a[n - i] >= x && a[n - i - 1] >= x) || (a[n + i] >= x && a[n + i + 1] >= x)) {
			return true;
		}
	}
	return a[1] >= x;
}
 
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= 2 * n - 1; i++) {
		scanf("%d", &a[i]);
	}
	int l = 1, r = 2 * n - 1, mid;
	while (l < r) {
		mid = (l + r + 1) / 2;
		if (check(mid)) {
			l = mid;
		} else {
			r = mid - 1;
		}
	}
	printf("%d\n", l);
	return 0;
}

Measured memory_bytes: 896
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
int roundup(int a,int b){return	(a-1)/b+1;}

signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	int ans=0;
	if(c>a+b){
		ans=a+2*b+1;
	}
	else ans=b+c;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int x, a; scanf("%d%d", &x, &a);
	
	printf("%d\n", (x >= a) * 10);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        if(a*c<b){
            System.out.println(c);
        }else{
            System.out.println(b/a);
        }
    }   
}

Measured memory_bytes: 21716
import sys
import math

if sys.platform in ['ios','win32','darwin']:
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N, A, B = MAP()
C = MAP()

ans = 0
for i in range(N-1):
	dist = C[i+1]-C[i]
	if A*dist > B:
		ans += B
	else:
		ans += A*dist

print(ans)

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

int main()
{
    bool flag=false;
    ll ina,inb,inx;
    cin >> ina >> inb >> inx;

    double rad;

    double x = (double)inx;
    double a = (double)ina;
    double b = (double)inb;
    

    if(x >= a*a*b/2)//overhalf
    {
        double c = 2.0*b;
        double d = 2.0*x;
        double a2 = a*a;
        d = d / a2;

        rad = atan2( c - d , a);
    }
    else
    {
        double y = x / (a*b);
        y = y * 2.0;
        rad = atan2(b, y);
    }

    double degree = rad * 180.0 / M_PI;

    printf("%.10lf\n",degree);
    return 0;
}



Measured memory_bytes: 256
n = gets.to_i
listed = {}
last = ""
ws = []
n.times{ |i|
  ws.push(gets.chomp)
}

ws.each { |w|
  if last == "" || (w[0] == last && listed[w].nil?)
  else
    print("No")
    print("\n")
    exit
  end
  listed[w] = true
  last = w[w.length - 1]
}

print("Yes")
print("\n")

Measured memory_bytes: 1788
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto O = RD!string;
	auto E = RD!string;

	string ans;
	foreach (i; 0..E.length)
	{
		ans ~= [O[i]] ~ [E[i]];
	}
	if (O.length > E.length)
		ans ~= O[$-1];
	
	writeln(ans);
	stdout.flush();
	debug readln();
}

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

#define      ll      long long int

int main( )
{
    ll k;
    string s;
    int i, j, ans, l;
    cin >> s >> k;
    l = (int) s.size();
    for (i = 0; i < l; i++) {
        if (s[i] != '1') { ans = s[i] - '0'; break; }
    }
    if (k - 1 < i) {
        cout << "1\n";
    }
    else {
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 26

typedef struct{
  int left;
  int right;
  int parent;
  int sibling;
  int deg;
  int depth;
  int height;
}Node;
 
Node node[MAX];
 
int Height(int i){
  int left=0,right=0; 
 
  if( node[i].left != -1 ) left = Height(node[i].left) + 1;
 
  if( node[i].right != -1 ) right = Height(node[i].right) + 1;
 
  if( right <= left ) return left;
 
  else if( right > left ) return right;
}
 
int main(){
  
  int n,id,right,left,i;
 
  scanf("%d",&n);
 
  for( i = 0 ; i < n ; i++ )
    {
      node[i].left = node[i].right = node[i].parent = node[i].sibling = -1;
      node[i].deg = node[i].depth = node[i].height = 0;
    }
   
  for( i = 0 ; i < n ; i++ )
    {
      scanf("%d%d%d",&id,&right,&left);
      if(right != -1 && left != -1){
    node[right].sibling = left;
    node[left].sibling = right;
    node[id].right = right;
    node[id].left = left;
    node[right].parent = node[left].parent = id;
    node[id].deg = 2;
      }
      else if( right == -1 && left != -1 ){
    node[id].left = left;
    node[left].parent = id;
    node[id].deg++;
      }
      else if( left == -1 && right != -1 ) {
    node[id].right = right;
    node[right].parent = id;
    node[id].deg++;
      }
    }
  int x;
 
  for( i = 0 ; i < n ; i++ )
    {
      x = i;
      while( node[x].parent != -1 )
    {
      x = node[x].parent;
          node[i].depth++;
    }
      node[i].height =  Height(i);
    }
 
  for( i = 0 ; i < n ; i++ )
    {
      printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,node[i].parent,node[i].sibling,node[i].deg,node[i].depth,node[i].height);
      if(node[i].parent == -1 ) printf("root\n");
      else if(node[i].deg == 0 ) printf("leaf\n");
      else printf("internal node\n");
    }
 
  return 0;
}

Measured memory_bytes: 612
# -*- coding: utf-8 -*-
import sys

def main():
	n = int(input())
	tmp = input()
	ans = list(tmp)
	
	ans_Q = []
	case = [["." for _ in range(n)] for _ in range(4)]
	case[0][0] = "S"
	case[0][1] = "S"
	case[1][0] = "W"
	case[1][1] = "W"
	case[2][0] = "S"
	case[2][1] = "W"
	case[3][0] = "W"
	case[3][1] = "S"
	
	for case_o in case:
		for i in range(1, n-1):
			if case_o[i] == "S" and ans[i] == "o":
				case_o[i+1] = case_o[i-1]
				continue
			if case_o[i] == "S" and ans[i] == "x":
				case_o[i+1] = run(case_o[i-1])
				continue
			if case_o[i] == "W" and ans[i] == "o":
				case_o[i+1] = run(case_o[i-1])
				continue
			if case_o[i] == "W" and ans[i] == "x":
				case_o[i+1] = case_o[i-1]
				continue
				
		if case_o[n-1] == "S" and ans[n-1] == "o":
			if case_o[0] == case_o[n-2]:
				if case_o[0] == "S" and ans[0] == "o":
					if case_o[1] == case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "S" and ans[0] == "x":
					if case_o[1] != case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "W" and ans[0] == "o":
					if case_o[1] != case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "W" and ans[0] == "x":
					if case_o[1] == case_o[n-1]:
						ans_Q = case_o
						break
		if case_o[n-1] == "S" and ans[n-1] == "x":
			if case_o[0] != case_o[n-2]:
				if case_o[0] == "S" and ans[0] == "o":
					if case_o[1] == case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "S" and ans[0] == "x":
					if case_o[1] != case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "W" and ans[0] == "o":
					if case_o[1] != case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "W" and ans[0] == "x":
					if case_o[1] == case_o[n-1]:
						ans_Q = case_o
						break
		if case_o[n-1] == "W" and ans[n-1] == "o":
			if case_o[0] != case_o[n-2]:
				if case_o[0] == "S" and ans[0] == "o":
					if case_o[1] == case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "S" and ans[0] == "x":
					if case_o[1] != case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "W" and ans[0] == "o":
					if case_o[1] != case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "W" and ans[0] == "x":
					if case_o[1] == case_o[n-1]:
						ans_Q = case_o
						break
		if case_o[n-1] == "W" and ans[n-1] == "x":
			if case_o[0] == case_o[n-2]:
				if case_o[0] == "S" and ans[0] == "o":
					if case_o[1] == case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "S" and ans[0] == "x":
					if case_o[1] != case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "W" and ans[0] == "o":
					if case_o[1] != case_o[n-1]:
						ans_Q = case_o
						break
				if case_o[0] == "W" and ans[0] == "x":
					if case_o[1] == case_o[n-1]:
						ans_Q = case_o
						break
	
	if len(ans_Q) == 0:
		print(-1)
	else:
		word = ""
		for w in ans_Q:
			word = word + w
		print(word)
	
def run(cher):
	if cher == "W":
		return "S"
	else:
		return "W"
		
if __name__ == "__main__":
	main()
	

Measured memory_bytes: 7692
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    char a,b;
    cin >> a >> b;
    cout << ((a*b=='H'*'D')? "D":"H") << '\n';
}

Measured memory_bytes: 256
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let c: usize = itr.next().unwrap().parse().unwrap();

    let mut event = Vec::new();
    for _ in 0..n {
        let s: usize = itr.next().unwrap().parse().unwrap();
        let t: usize = itr.next().unwrap().parse().unwrap();
        let a: usize = itr.next().unwrap().parse().unwrap();
        event.push((s, 0, a));
        event.push((t, 1, a));
    }
    event.sort();

    let mut ans = 0;
    let mut channel = vec![0; c + 1];
    for &x in event.iter() {
        let typ = x.1;
        let chn = x.2;
        if typ == 0 {
            // start
            channel[chn] += 1;
        } else {
            // end
            channel[chn] -= 1;
        }

        ans = max(
            ans,
            (1..c + 1).fold(0, |acc, x| if channel[x] > 0 { acc + 1 } else { acc }),
        );
    }
    println!("{}", ans);
}


Measured memory_bytes: 15220
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

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

const ll MOD = 1e9 + 7;


int main(int argc, char* argv[]) {
	
	int n;
	cin >> n;
	set<string> s;
	for (int i = 0; i < n; i++) {
		string si;
		cin >> si;
		s.insert(si);
	}

	cout << s.size() << endl;
}

Measured memory_bytes: 19132
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define mp make_pair
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k)

const long long MXN = 1e5 + 100;
const long long MNN = 2e3 + 10;
const long long MOD = 998244353;
const long long INF = 1e18;
const long long OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

llong n, b[MXN], cnt[MXN];

int main(){
	ios;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> b[i];
		cnt[b[i]]++;
	}
	sort(b + 1, b + n + 1);
	if(b[n] - b[1] > 1) return cout << "No", 0;
	else if(b[n] - b[1] == 0){
		if(b[n] == n - 1){
			cout << "Yes";
			return 0;
		}
		else if(b[n] * 2 <= n){
			cout << "Yes";
			return 0;
		}
		cout << "No";
		return 0;
	}
	else{
		if(n - cnt[b[n]] + 1 <= b[n] && b[n] <= n - cnt[b[n]] + cnt[b[n]] / 2){
			cout << "Yes";
			return 0;
		}
		cout << "No";
		return 0;
	}
	return 0;
}


Measured memory_bytes: 1792
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
aa=min(a,(x+a+1)//500)+1
bb=min(b,(x+b+1)//100)+1
cc=min(c,(x+c+1)//50)+1
for k in range(aa):
  for j in range(bb):
    for i in range(cc):
      if 50*i+100*j+500*k==x:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
from bisect import bisect_left
from math import sqrt
MOD = 10**9 + 7

def main():
    lim, n = map(int, input().split())
    num, tmp = [], []
    for i in range(1, int(sqrt(lim))+1):
        num.append(i)
        if i**2 != lim:
            tmp.append(lim//i)
    while len(tmp) > 0:
        num.append(tmp.pop(-1))
    m = len(num)
    dp = [[0]*m for _ in range(n)]
    dp[0][0] = 1
    for j in range(1, m):
        dp[0][j] = num[j] - num[j-1]
    for i in range(1, n):
        for j in range(1, m):
            dp[i-1][j] += dp[i-1][j-1]
        for j in range(m):
            idx = bisect_left(num, lim//num[j])
            p = num[j]
            if j > 0:
                p -= num[j-1]
            dp[i][j] = dp[i-1][idx] * p % MOD
    print(sum(dp[-1])%MOD)

if __name__ == "__main__":
    main()

Measured memory_bytes: 122584
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x, y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

template <typename T>void print(T v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<v.size(); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto i= v.begin(); i!=v.end(); i++)cout<<setw(w)<<*i<<" ";cout<<endl;}
template <typename T>void print_vv(T v){if(v.size()==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<v[0].size(); j++)cout<<setw(w)<<j<<" ";cout<<endl;for(auto i= 0; i<v.size(); i++){cout<<i<<" {";for(auto j = 0; j!=v[i].size(); j++){cout<<setw(w)<<v[i][j]<<",";}cout<<"},"<<endl;}cout<<endl;}
template <class T, class U> void print_m(map<T,U> m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}

int main(){
    int  n, k;
    cin>>n>>k;
    
    set<int> s;

    int d,x;
    forn(i,k){
        cin>>d;
        forn(i,d){
            cin>>x;
            s.insert(x);
        }
    }
    int cnt = 0;
    fore(i,1,n+1){
        if(s.count(i)==0){
            ++cnt;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

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

using namespace std;

const int INF = 1 << 29;

struct Bipartite_Matching
{
  vector< vector< int > > graph;
  vector< int > dist, match;
  vector< bool > used, vv;

  Bipartite_Matching(int n, int m)
  {
    graph.resize(n);
    match.assign(m, -1);
    used.assign(n, false);
  }

  void add_edge(int u, int v)
  {
    graph[u].push_back(v);
  }

  void bfs()
  {
    dist.assign(graph.size(), -1);
    queue< int > que;
    for(int i = 0; i < graph.size(); i++) {
      if(!used[i]) {
        que.emplace(i);
        dist[i] = 0;
      }
    }

    while(!que.empty()) {
      int a = que.front();
      que.pop();
      for(auto &b : graph[a]) {
        int c = match[b];
        if(c >= 0 && dist[c] == -1) {
          dist[c] = dist[a] + 1;
          que.emplace(c);
        }
      }
    }
  }

  bool dfs(int a)
  {
    vv[a] = true;
    for(auto &b : graph[a]) {
      int c = match[b];
      if(c < 0 || (!vv[c] && dist[c] == dist[a] + 1 && dfs(c))) {
        match[b] = a;
        used[a] = true;
        return (true);
      }
    }
    return (false);
  }

  int bipartite_matching()
  {
    int ret = 0;
    while(true) {
      bfs();
      vv.assign(graph.size(), false);
      int flow = 0;
      for(int i = 0; i < graph.size(); i++) {
        if(!used[i] && dfs(i)) ++flow;
      }
      if(flow == 0) return (ret);
      ret += flow;
    }
  }
};

int main()
{
  int N, M, L;
  int cost[100][100];
  pair< int, int > tp[1000];

  while(scanf("%d %d %d", &N, &M, &L), L) {
    for(int i = 0; i < N; i++) {
      for(int j = 0; j < N; j++) cost[i][j] = INF;
      cost[i][i] = 0;
    }

    for(int i = 0; i < M; i++) {
      int u, v, d;
      scanf("%d %d %d", &u, &v, &d);
      cost[u][v] = cost[v][u] = d;
    }
    for(int i = 0; i < L; i++) {
      scanf("%d %d", &tp[i].second, &tp[i].first);
    }

    for(int k = 0; k < N; k++) {
      for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
          cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
        }
      }
    }

    sort(tp, tp + L);
    Bipartite_Matching flow(L, L);
    for(int i = 0; i < L; i++) {
      for(int j = i + 1; j < L; j++) {
        if(i == j) continue;
        if(tp[j].first - tp[i].first >= cost[tp[i].second][tp[j].second]) {
          flow.add_edge(i, j);
        }
      }
    }
    printf("%d\n", L - flow.bipartite_matching());
  }
}

Measured memory_bytes: 5596
#include <iostream>
#include <iterator>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
int main(void)
{
    
    int N;
    int ans;
    string S;
    vector<string> v;
    vector<string> ans_v;
    int k =0;
    int count = 0;

    cin >> N;

    ans = N % 2;

    if(ans > 0){

        ans = N /2 +1;
    } else {

        ans = N / 2;
    }

    cout << ans;
    
    return 0;
}


Measured memory_bytes: 256
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=5e18;
typedef pair<int,int> P;
int n,q,par[100005]={},com,x,y;
int find(int x) {
  if(par[x]==x) {
    return x;
  }
  return par[x]=find(par[x]);
}
void unit(int x,int y) {
  x=find(x),y=find(y);
  if(x!=y) {
    par[x]=y;
  }
}
int main() {
  cin.tie(0),cout.tie(0);
  cin >> n >> q;
  for(int i=0; i<n; i++) {
    par[i]=i;
  }
  for(int i=0; i<q; i++) {
    cin >> com;
    if(com) {
      cin >> x >> y;
      cout << (find(x)==find(y)?1:0) << endl;
    }
    else {
      cin >> x >> y;
      unit(x,y);
    }
  }
}


Measured memory_bytes: 3240
filter1 :: Int -> Bool
filter1 n = n `mod` 3 == 0

filter2 :: Int -> Bool
filter2 n
  | n < 3           = False
  | n `mod` 10 == 3 = True
  | otherwise       = filter2 (n `div` 10)

callFilter :: Int -> Bool
callFilter n = filter1 n || filter2 n

call :: Int -> [Int]
call n = filter callFilter [1..n]

main :: IO ()
main = do
    n <- getLine >>= \l -> return (read l :: Int)
    mapM_ putStr $ map (\n -> " " ++ show n) $ call n
    putStrLn ""


Measured memory_bytes: 4136
#include<stdio.h>

int main(){
   int x,y;
   scanf("%d %d", &x, &y);

   if(y < 2*x || x*4 < y){
      printf("No\n");
   }else if(y % 2 == 1){
      printf("No\n");
   }else{
      printf("Yes\n");
   }
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N; cin >> N;
    vector<i64> L(N);
    REP(i, N) cin >> L[i];

    i64 s = 0;
    i64 maxl = 0;
    REP(i, N) {
        s += L[i];
        chmax(maxl, L[i]);
    }
    if (maxl < (s - maxl)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int num1=0, num2=0, num3=0;
scanf("%d",&num1);
scanf("%d",&num2);
if(num1 != 1 && num2 !=1){
num3=1;
}else if(num1 != 2 && num2 !=2){
num3=2;
}else if(num1 != 3 && num2 !=3){
num3=3;
}
 printf("%d\n", num3);
 return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int> 
#define vll vector<ll> 
#define vpll vector<pair<ll ,ll>>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define map map<ll ,ll>
#define umap unordered_map<ll , ll>
#define endl "\n"
#define set set<ll> 
#define setC set<char>
#define fast ios::sync_with_stdio(0); cin.tie(0);
#define fastcout ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define testcases int tt = 1 ; cin >> tt ; for(int i = 1 ; i <= tt ; ++i)
#define codejam cout << "Case #"<<i <<": "; 
#define FOR(i,a,n) for(int i = a ; i <= n ; ++i)
#define FORback(i,a,n) for(int i = n ; i >= a ; --i)

typedef long long int ll;

void solv(){
    ll n , w;
    cin >> n  >> w;
    
    vi value(n) , weight(n);

    FOR(i , 0 , n-1){
        cin >>weight[i];
        cin >> value[i];
    }

    vvll dp(w+1 , vll(n+1 , 0));

    FOR(i , 1 , w){
        FOR(j , 1 , n){
            
        // here we wanted 

        if(weight[j-1] <= i){
            dp[i][j]  = max(dp[i-weight[j-1]][j-1] + value[j-1] , dp[i][j-1]) ;
        }
        else{
            dp[i][j] = dp[i][j-1];
        }

        }
    }
    
    cout << dp[w][n] << endl;
}

int main(){
    fast ;    
    // testcases{
        // codejam ;
        solv();
    // } 
}




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

int main(){

	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i=1;i<=n;++i){
    	for(ll j=1;j<=n;++j){
    		for(ll k =1;k<=n;++k){
    			ll x = __gcd(j,k);
    			ans += __gcd(i,x);
    		}
    	}
    }


    cout << ans << "\n"; 
    

	return 0;
}

Measured memory_bytes: 3652
#!/usr/bin/perl
my ($a,$b) = map { $_ - 0 } split(/\s+/,<STDIN>);

my $r = 0;

if( $a >= 13 ){
  $r = $b;
} elsif( $a >= 6 ){
  $r = $b / 2;
}
print "$r\n";


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

ll solve(ll a, ll b){
	if(b == 0) return a;
  
  	return solve(b, a % b);
}

int main(){
	ll a, b;
  	cin >> a >> b;
  
  	ll ans = a * b / solve(a, b);
  
  	cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
const int INF = 1000;
int main() {
  string s;
  cin >> s;
  int ans = INF;
  rep(i, s.size() - 2) {
    int x = (s[i + 2] - '0');
    x += 10 * (s[i + 1] - '0');
    x += 100 * (s[i] - '0');
    ans = min(ans, abs(753 - x));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
<?php
$a = intval(trim(fgets(STDIN)));
$b = intval(trim(fgets(STDIN)));
if($a + $b === 3) {
    $c = 3;
} elseif($a + $b === 4) {
    $c = 2;
} elseif($a + $b === 5) {
    $c = 1;
}
echo $c;

Measured memory_bytes: 4604
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b>>1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

//////////////////////////////////////

int main() {
	ll A;
	ll B;
	cin >> A >> B;
	cout << A * B << endl;
}


Measured memory_bytes: 3636
main () {
    int H, W;
    scanf("%d %d", &H, &W);
    while ((H != 0) && (W != 0)) {
        for (int j = 1; j <= W; j++) 
        {
            printf("#");
        }
        printf("\n");
        for (int i = 2; i <= H - 1; i++) 
        {
            printf("#");
            for (int j = 2; j <= W - 1; j++) 
            {
                printf(".");
            }
            printf("#\n");
        }
        for (int j = 1; j <= W; j++) 
        {
            printf("#");
        }
        printf("\n");
        scanf("%d %d", &H, &W);
        printf("\n");
    }
}


Measured memory_bytes: 2040
n = int(input())
res = [[0]*9 for _ in range(9)]
for i in range(1,n+1):
  a = i%10
  if a== 0: continue
  while i > 0:
    b = i%10
    i = i//10
  res[a-1][b-1] += 1


ans = 0

for i in range(9):
  for j in range(9):
    ans += res[i][j] * res[j][i]

print(ans)
    

Measured memory_bytes: 3064
<?php
list($s) = strs();
$cnt = 0;
$n = strlen($s);
for ($i = 1; $i < $n; ++$i) if ($s[$i] !== $s[$i - 1]) $cnt++;
echo $cnt;
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}


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

int main() {
    int n;
    cin >> n;
    int h[n];
    for(int i = 0; i < n; i++) {
        cin >> h[i];
    }
    int ans = 0;
    int count = 0;
    for(int i = 0; i < n - 1; i++) {
        if(h[i] >= h[i + 1]) {
            count++;
        } else {
            count = 0;
        }
        ans = max(ans, count);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for (int i=1;i<=9;i++)
	{
		if (n%i==0&&(n/i)<=9)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define sp(x) fixed<<setprecision(x)
#define p_q priority_queue
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{

    fast_io;
    
    ll n,cnt = 0;
    cin>>n;
    
    vector<ll> a(n);
    for(ll &i : a)
        cin>>i;

    sort(a.begin(), a.end());

    for(ll i=0;i<n-2;i++)
    {
        for(ll j=i+1;j<n-1;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if(a[i]!=a[j] && a[j]!=a[k] && (a[j]+a[i] > a[k]) )
                    cnt++;
            }
        }
    }

    cout<<cnt<<endl;

return 0;
}


Measured memory_bytes: 3644
def roll(die, d):
    if d == "E":
        return [die[3], die[1], die[0], die[5], die[4], die[2]]
    if d == "N":
        return [die[1], die[5], die[2], die[3], die[0], die[4]]
    if d == "S":
        return [die[4], die[0], die[2], die[3], die[5], die[1]]
    if d == "W":
        return [die[2], die[1], die[5], die[0], die[4], die[3]]
    if d == "L":
        return [die[0], die[3], die[1], die[4], die[2], die[5]]
    if d == "R":
        return [die[0], die[2], die[4], die[1], die[3], die[5]]

die = list(map(int, input().split()))
n = int(input())
for i in range(n):
    a, b = list(map(int, input().split()))
    if die[0] == a:
        pass
    elif die[1] == a:
        die = roll(die, "N")
    elif die[2] == a:
        die = roll(die, "W")
    elif die[3] == a:
        die = roll(die, "E")
    elif die[4] == a:
        die = roll(die, "S")
    elif die[5] == a:
        die = roll(roll(die, "E"), "E")
    while True:
        if die[1] == b:
            break
        die = roll(die, "R")
    print(die[2])

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n; cin>>n;
    vi l(n);
    rep(i, n) cin>>l[i];
    sort(all(l));
    map<int, int> M;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            M[l[i]+l[j]]++;
        }
    }

    ll ans=1;
	rep(i, 3) ans*=n-i;
	ans /= 6;
    for(auto e:M){
        auto itr = lower_bound(l.begin(), l.end(), e.fi);
        ans -= e.se*distance(itr, l.end());
    }
    cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main() {
    int a[26] = {};
    char c;
    int i;
    while((c = getchar()) != EOF) {
        int k = c - 'a';
        a[k] += 1;
    }
    for (i=0; i<26; i++) {
        int tmp = a[i];
        if (tmp % 2 == 0)
            continue;
        else {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int vis[20],map[20][20],n,m,sum;
void dfs(int x)
{
	int i;
	for(i=1;i<=n;i++)
	if(vis[i]!=1)
	break;
	if(i==n+1)
	{
		sum++;
		return;
	}
	for(i=1;i<=n;i++)
	if(map[x][i]==1&&vis[i]==0)
	{
		vis[i]=1;
		dfs(i);
		vis[i]=0;
	}
	return ;
}
int main()
{
	int i,j,x,y;
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		memset(map,0,sizeof(map));
		memset(vis,0,sizeof(vis));
		for(i=1;i<=m;i++)
		{
			scanf("%d%d",&x,&y);
			map[x][y]=1;
			map[y][x]=1;
		}
		vis[1]=1;
		sum=0;
		for(i=2;i<=n;i++)
		{
			if(map[1][i]==1)
			{
			vis[i]=1;
			dfs(i);
			vis[i]=0;
		}
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define ff first 
#define ss second
#define mod 1000000007
#define lim 100005
#define nfs_mw ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

int main()
{
	nfs_mw;
	int i,j,n,comp[21] = {},v,mask;
	cin>>n;
	for(i=1; i<=n; i++)
		for(j=0; j<n; j++){
			cin>>v;
			comp[i] |= (v<<j);
		}

	ll dp[1<<21] = {};
	vector<int> mask_active[n+1];
	for(i=0; i<(1<<n); i++)
		mask_active[__builtin_popcount(i)].pb(i);
	dp[0] = 1;
	
	for(i=1; i<=n; i++)
		for(auto mask:mask_active[i]){
			int p = mask&comp[i];
			while(p){
				int match = p&(-p);
				dp[mask] = (dp[mask] + dp[mask^match])%mod;
				p ^= match;
			}
		}

	cout<<dp[(1<<n)-1];
}

Measured memory_bytes: 26560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
const ll mei = (ll)1e9 + 7;

int main(){
  ll k, x;
  cin >> k >> x;
  rep2(i, x + 1 - k, x + k){
    cout << i;
    hina;
  }
  memi;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

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

const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(){}
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

P crosspoint(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line

  return m[0] + B / A * (m[1] - m[0]);
}

typedef vector<P> G;

double area(const G& g) {
  double A = 0;
  for (int i = 0; i < g.size(); ++i) {
    A += cross(g[i], g[(i+1)%g.size()]);
  }
  return A/2;
}

int main() {
  int n;
  while(cin>>n,n) {
    double a[4][n];
    REP(i,4) {
      REP(j,n) {
        cin >> a[i][j];
      }
    }
    L tate[n+2];
    L yoko[n+2];
    tate[0] = L(P(0,0),P(0,1));
    tate[n+1] = L(P(1,0),P(1,1));
    yoko[0] = L(P(0,0),P(1,0));
    yoko[n+1] = L(P(0,1),P(1,1));
    REP(i,n) {
      tate[i+1] = L(P(a[0][i],0), P(a[1][i],1));
      yoko[i+1] = L(P(0,a[2][i]), P(1,a[3][i]));
    }
    P p[n+2][n+2];
    REP(i,n+2) REP(j,n+2) {
      p[i][j] = crosspoint(yoko[i], tate[j]);
    }
    double res = 0;
    REP(i,n+1) {
      REP(j,n+1) {
        G g;
        g.push_back(p[i][j]);
        g.push_back(p[i][j+1]);
        g.push_back(p[i+1][j+1]);
        g.push_back(p[i+1][j]);
        res = max(res, area(g));
      }
    }
    printf("%.8f\n",res);
  }
}

Measured memory_bytes: 0
n = int(input())
a = list(map(int, input().split()))
b = {1: 0, 2: 0, 4: 0}
for i in a:
    if i % 2:
        b[1] += 1
    else:
        if (i // 2) % 2:
            b[2] += 1
        else:
            b[4] += 1
if b[1] + b[2] - 1 <= b[4]:
    print("Yes")
    exit()
if b[1] <= b[4]:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 15020