akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  int mx = 0;
  int x;
  rep(i, N) {
    cin >> v[i];
    mx = max(mx, v[i]);
    if (mx == v[i]) x = i;// MAX値のなかで最後に出てきた番号
  }
  int mx2=0;//2番目に大きい数または二つ目のMAX値
  rep(i, N) {
    if (i != x) {// xを除いてMAX値をチェック
      mx2 = max(mx2, v[i]);
    }
  }
  
  rep(i, N) {
    if (i != x) cout << mx << endl;// MAX値が二つ以上ある場合、変わらずmxを出力すればよい。そうでなければ2番目に大きい数を入れる。
    else cout << mx2 << endl;
  }
  return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=10000000000000000ll;

int main()
{
  int n;
  scanf("%d",&n);
  static pair<ll,ll> P[10000];
  for(int i=0;i<n;i++){
    scanf("%lld%lld",&(P[i].first),&(P[i].second));
    P[i].first+=P[i].second;
  }
  sort(P,P+n);
  static ll dp[5010][5010];
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n;j++){
      dp[i][j]=INF;
    }
  }
  dp[0][0]=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<=i;j++){
      if(dp[i][j]<=P[i].first-P[i].second){
	dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+P[i].second);
      }
      dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
    }
  }
  int ans=0;
  for(int j=0;j<=n;j++){
    if(dp[n][j]<INF)ans=j;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 196096
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll MOD=1e9+7;
const int INF=1<<30;

int main(){
  int n,a;
  cin >> n >> a;
  if(n%a==0){
    cout << n/a << endl;
  }
  else{
    cout << n/a+1 << endl;
  }
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
#define MAXN 100100
#define ll long long
int n, m, cnt, a[MAXN];
int main()
{
	scanf("%d%d",&n,&m);
	if(m >= n) printf("unsafe\n");
	else printf("safe\n");
	
	return 0;
}

Measured memory_bytes: 3768
#include<stdio.h>
#include<math.h>

main(){
    int A,B;
    scanf("%d%d",&A,&B);
    if(A != 1 && B != 1){
        printf("1");
    }
    else if(A != 2 && B != 2){
        printf("2");
    }
    else{
        printf("3");
    }

}



Measured memory_bytes: 128
import sys
readline = sys.stdin.readline

N = int(readline())
A = list(map(int,readline().split()))

# dp[i][j] = 元の数列の中の連続する区間i～jに対して、最終局面に行った時のX-Yの最大値

dp = [[0] * (N + 1) for i in range(N + 1)]
  
for length in range(1, N + 1):
  for i in range(N - length + 1):
    j = i + length
    
    if (N - length) % 2 == 0: # 先手番
      dp[i][j] = max(dp[i + 1][j] + A[i], dp[i][j - 1] + A[j - 1])
      
    else: # 後手番
      dp[i][j] = min(dp[i + 1][j] - A[i], dp[i][j - 1] - A[j - 1])

print(dp[0][N]) 

Measured memory_bytes: 144980
import numpy as np
from collections import deque
import sys 
N=int(input())
A=np.array([int(i) for i in input().split()])
B=np.array([int(i) for i in input().split()])
C = A-B
minus_idx=np.where(C<0)
plus_idx=np.where(C>=0)
minus = np.sum(C[minus_idx])
plus = deque(np.sort(C[plus_idx]))
len_plus = len(plus)

if len(minus_idx[0]) == 0:
    print(0)
    sys.exit()
if len_plus == 0:
    print(-1)
    sys.exit()
count = 0
while minus<0:
    try:
        minus += plus.pop()
        count += 1
        len_plus -= 1
    except:
        print(-1)
        sys.exit()
print(len(minus_idx[0])+count)

Measured memory_bytes: 23976
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modBase = 1000000007 :: Integer

a *% b = ( a * b ) `mod` modBase

primeFactorization 1 = []
primeFactorization n = f 2 n
	where
		f p n
			| n == p = [p]
			| n `mod` p == 0 = p : f p ( n `div` p )
			| otherwise = f ( p + 1 ) n

nCr 0 _ = 1
nCr _ 0 = 1
nCr n r = let r' = min r ( n - r ) in if r' == 0
	then 1
	else nCr ( n - 1 ) ( r' - 1 ) * n `div` r'

nHr n r = nCr ( n + r - 1 ) r

main = do
	[ n, m ] <- map fromIntegral <$> readInts
	let degrees = map ( fromIntegral . length ) $ group $ primeFactorization m
	print $ foldl (*%) 1 $ map ( n `nHr` ) degrees

Measured memory_bytes: 892
void main() {
    dchar[] s = readln.chomp.to!(dchar[]);
    int cnt;
    foreach (i; 1 .. s.length) {
        if (s[i] == s[i-1]) {
            if (s[i] == '1') s[i] = '0';
            else s[i] = '1';
            ++cnt;
        }
    }
    cnt.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 2840
n = int(input())
a = list(map(int,input().split()))
ans = 1
ok = True
for i in a:
  if ok == True:
    ans *= i
  if ans > 1000000000000000000:
    ok = False
  if i == 0:
    print(0)
    exit()
if ok:
  print(ans)
else:
  print(-1)

Measured memory_bytes: 21772
// need
#include <iostream>
#include <algorithm>
// data structure
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
//#include <deque>
#include <valarray>
#include <unordered_map>
#include <array>
// stream
//#include <istream>
#include <sstream>
//#include <ostream>
#include <fstream>
// etc
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
//#include <chrono>
#include <random>
#include <numeric>
using namespace std;
 
int main()
{
  int c[4];
  int num;
  c[0] = c[1] = c[2] = c[3] = 0;
  for(int i = 0; i < 6; i++){
	cin >> num;
    switch(num){
      case 1:
        c[0]++;
        break;
      case 2:
        c[1]++;
        break;
      case 3:
        c[2]++;
        break;
      case 4:
        c[3]++;
        break;
    }
  }
  for(int i = 0; i < 4; i++){
    if(c[i] == 0 || c[i] >= 3){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


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

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

  if (s == "Sunny") {
    cout << "Cloudy" << endl;
  } else if(s == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 3544
#include <iostream>
#include <queue>
#include <utility>


using namespace std;

int main()
{
  int n, q;
  cin >> n >> q;
  queue< pair<string, int> > Q;


  for (int i = 0; i < n; ++i) {
    string name;
    int time;
    cin >> name >> time;
    Q.push(make_pair(name, time));
  }

  int time_stamp = 0;

  while (!Q.empty()) {
    if (Q.front().second <= q) {
    time_stamp += Q.front().second;
cout << Q.front().first << " " << time_stamp  << endl;
      Q.pop();
    } else {
      time_stamp += q;
      Q.front().second -= q;
      pair<string, int> rescheduled = Q.front();
      Q.pop();
      Q.push(rescheduled);
    }
  }
      

  
  
  return 0;
}

Measured memory_bytes: 4404
N,Ma,Mb=list(map(int,input().split()))
ABC=[tuple(map(int,input().split())) for i in range(N)]
inf=float("inf")
DP=[[inf]*401 for i in range(401)]
DP[0][0]=0
for a,b,c in ABC:
   for i in reversed(range(401)):
      for j in reversed(range(401)):
         if DP[i][j]!=inf:
            DP[i+a][j+b]=min(DP[i][j]+c,DP[i+a][j+b])
ans=inf
for i in range(1,401):
   for j in range(1,401):
      if Ma*j==Mb*i:
         ans=min(ans,DP[i][j])
print(-1 if ans==inf else ans)

Measured memory_bytes: 10772
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(int (i)=(0);(i)<(n);++i)
#define ll long long
#define INF 1000000000

int dp[100010][3];

int Max(int num1,int num2,int num3){
	int max = num1;
 
 	if(max<num2)max = num2;
  	if(max<num3)max = num3;

  	return max;
}

int main()
{
	int n,x,y,z;
	cin >> n;

	int a[n+1],b[n+1],c[n+1];

	REP(i,n){
		cin >> x >> y >> z;
		a[i]=x; b[i]=y; c[i]=z;
	}

	dp[0][0] = a[0]; dp[0][1] = b[0]; dp[0][2] = c[0];

	for(int i=1;i<n;++i){
		REP(j,3){
			dp[i][0] = a[i]+max(dp[i-1][1],dp[i-1][2]);
			dp[i][1] = b[i]+max(dp[i-1][0],dp[i-1][2]);
			dp[i][2] = c[i]+max(dp[i-1][0],dp[i-1][1]);
		}  
	}

	cout << Max(dp[n-1][0],dp[n-1][1],dp[n-1][2]) << endl;

	return 0;
}

Measured memory_bytes: 2560
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int t = sc.nextInt();
        // 出力
        System.out.println((int)(t+0.5)/a*b);
    }
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, ll> pcl;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    int a;
    cin >> a;
    cout << a + pow(a, 2) + pow(a, 3) << endl;
    return 0;
}

Measured memory_bytes: 4148
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdio.h>
#include<math.h>
using namespace std;
int main(){
  long long N,A,B,C,min1=1e12;
  bool OK=false;
  cin>>N;
  A= sqrt(N);
  for(long long i=2;i<=A;i++){
    if(N%i==0){
    OK=true;
    if(min1>(i-1)+(N/i-1)) min1=(i-1)+(N/i-1); 
  }
  }
  if(N==2) cout<<1<<endl;
  else if(OK) cout<<min1<<endl;
  else cout<<N-1<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define SZ(X) ((int64_t)((X).size()))
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define intmax (std::numeric_limits<int64_t>::max() / 4)
#define doublemax (std::numeric_limits<double>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

//sort(ALL(v),greater<int>());


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

	//int K, S;
	//cin >> K >> S;
	//int ans = 0;
	//rep(X, K + 1) {
	//	if (0 <= S - X && S - X <= 2 * K) {
	//		int YZ = S - X;
	//		ans += min(YZ, 2 * K - YZ) + 1;
	//	}
	//}
	//cout << ans << endl;

	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	rep(i, tx - sx)cout << 'R';
	rep(i, ty - sy)cout << 'U';
	rep(i, tx - sx)cout << 'L';
	rep(i, ty - sy)cout << 'D';
	cout<<'D';
	rep(i, tx - sx + 1)cout << 'R';
	rep(i, ty - sy + 1)cout << 'U';
	cout << 'L'<<'U';
	rep(i, tx - sx+1)cout << 'L';
	rep(i, ty - sy+1)cout << 'D';
	cout << 'R' << endl;

	return 0;
}

Measured memory_bytes: 384
<?php
fscanf(STDIN,"%s",$str);
fscanf(STDIN,"%s",$q);
 
while($order = trim(fgets(STDIN))){
    $array = explode(" ",$order);
 
    if ($array[0] == "print"){
        print_ab($str,$array[1],$array[2]);
        
    }elseif ($array[0] == "reverse"){
        $str = reverse($str,$array[1],$array[2]);
 
    }elseif ($array[0] == "replace"){
        $str = replace($str,$array[1],$array[2],$array[3]);
    }
}//while
 
 
//----------------
//kansuu
//----------------
function print_ab($text,$a,$b){
    echo substr($text, $a, $b-$a+1).PHP_EOL;
}
 
function reverse($text,$a,$b){
    $change = strrev(substr($text, $a, $b-$a+1));
    return substr_replace($text, $change, $a, $b-$a+1);
}
 
function replace($text,$a,$b,$p){
    return substr_replace($text, $p, $a, $b-$a+1);
}

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

const int INF=1e9;
vector<int> dr={0,1,0,-1};
vector<int> dc={1,0,-1,0};

int main(){
  int H,W;
  cin >> H >> W;
  pair<int,int> start,goal;
  cin >> start.first >> start.second >> goal.first >> goal.second;
  start.first--;
  start.second--;
  goal.first--;
  goal.second--;
  vector<string> maze(H);
  for(int i=0;i<H;i++){
    cin >> maze[i];
  }
  vector<vector<int>> dist(H,vector<int>(W,INF));
  dist[start.first][start.second]=0;
  deque<pair<int,int>> deq;
  deq.push_front(start);
  while(!deq.empty()){
    pair<int,int> state=deq.front();
    int d=dist[state.first][state.second];
    deq.pop_front();
    for(int i=0;i<4;i++){
      int nr=state.first+dr[i];
      int nc=state.second+dc[i];
      if(nr<0 || nr>=H || nc<0 || nc>=W){
        continue;
      }
      if(dist[nr][nc]<=d){
        continue;
      }
      if(maze[nr][nc]=='#'){
        continue;
      }
      dist[nr][nc]=d;
      deq.push_front(make_pair(nr,nc));
    }
    for(int er=-2;er<=2;er++){
      for(int ec=-2;ec<=2;ec++){
        int dw=d+1;
        int nr=state.first+er;
        int nc=state.second+ec;
        if(nr<0 || nr>=H || nc<0 || nc>=W){
          continue;
        }
        if(dist[nr][nc]<=dw){
          continue;
        }
        if(maze[nr][nc]=='#'){
          continue;
        }
        dist[nr][nc]=dw;
        deq.push_back(make_pair(nr,nc));
      }
    }
  }
  if(dist[goal.first][goal.second]==INF){
    cout << -1 << endl;
    return 0;
  }
  else{
    cout << dist[goal.first][goal.second] << endl;
  }
}



Measured memory_bytes: 9464
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    r,g,b,n = map(int, input().split())
    res = 0
    for i in range(3001):
        temp = n - r*i
        for j in range(3001):
            temp2 = temp - g*j
            if temp2>=0 and temp2%b==0:
                res += 1
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 40684
#include<stdio.h>
#define N 10000
#define Q 500

int serch(int,int,int []);

int main(){
  int S[N];
  int i,j,q,n,sum=0,t;

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

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&t);
     if(serch(t,n,S)){
	sum++;
      }
  }

  printf("%d\n",sum);  
}

int serch(int t,int n,int A[]){
  int i=0;
  for(i=0;i<n;i++){
    if(A[i]==t){
      return 1;
    }
  }
  return 0;
}



Measured memory_bytes: 2740
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード

//ループ
#define REP(i, n) for(int i = 0; i < n; i++) //普通のループ
#define REPR(i, n) for(int i = n; i >= 0; i--) //逆ループ
#define FOR(i, m, n) for(int i = m; i < n; i++) //最初の数値を指定したループ

//型名省略
typedef long long ll;

using namespace std;

//ll exponentiation(int num, int mutiplier);
//ll GetDigit(ll num);

int main(){
    int N, K, digits=0;
    ll result=0, exp;
    vector<int> tmp; 
    
    cin >> N >> K;
    if(N<1 || N>1000000000){
        return 1;
    }
    if(K<2 || K>10){
        return 1;
    }

    while(1){
        if(N/K==0){
            //printf("digits=%d N=%d K=%d N/k=%d\n", digits, N, K, N/K);
            //tmp.resize(digits+1);
            //tmp[digits] = N%K;
            //printf("K=%d N/K=%d N%K=%d digits=%d tmp[digits]=%d\n", K, N/K, N%K, digits, tmp[digits]);
            digits++;
            break;
        }
        //tmp.resize(digits+1);
        //tmp[digits] = N%K;
        //printf("K=%d N/K=%d N%K=%d digits=%d tmp[digits]=%d\n", K, N/K, N%K, digits, tmp[digits]);
        //printf("digits=%d N=%d K=%d N/k=%d\n", digits, N, K, N/K);
        digits++;
        N=N/K;
    }

    /*while(1){
        if(digits==-1){
            break;
        }
        exp = exponentiation(K, digits);
        result = result + tmp[digits]*exp;
        printf("exp=%d K=%d digits=%d tmp[digits]=%d result=%d \n", exp, K, digits, tmp[digits], result);
        digits--;
    }*/
    
    cout << digits;

    return 0;
}


/*ll exponentiation(int num, int multiplier){
    ll ret=1;
    REP(i, multiplier){
        ret = ret*num;
    }
    return ret;
}

ll GetDigit(ll num){
    int digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}*/

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  char str[20001]; cin>>str;
  int top=0,cnt=0,data[20000],area[10000]={},num=0,len=0,sum=0;
  for(int i=0;str[i]!='\0';++i,++len){
    if(str[i]=='\\') data[top++]=i;
    else if(str[i]=='/'&&top!=0){
      int add=i-data[--top];
      area[num]+=add;
      sum+=add;
      if(top==0) ++num;
    }
  }
  if(top!=0){
    top=0;
    int end=data[0],revarea[10000]={},num2=0;
    for(int i=len-1;i>=end;--i){
      if(str[i]=='/') data[top++]=i;
      else if(str[i]=='\\'&&top!=0){
	revarea[num2]+=data[--top]-i;
	if(top==0) ++num2;
      }
    }
    for(int i=0;i<num2;++i) area[num+i]=revarea[num2-i-1];
    num+=num2;   
  }
  cout<<sum<<endl<<num;
  for(int i=0;i<num;++i) cout<<" "<<area[i];
  cout<<endl;
  return 0;
}



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


int huga(string &S) {
	if (S[0] == 'A' && S[1] == 'B' && S[2] == 'C' && (int)S.size() == 3) return 1;
	else return 0;
}

string hoge(string S, int x) {
	char X = 'A' + x;

	for (int i = 0; i < (int)S.size() - 2; i++) {
		if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') {
			S[i] = X;
			S.erase(i + 1, 2);
		}
	}
	return S;
}

int hoo(string &S, int c) {
	int i, j = 0, count[4] = {};
	for (i = 0; i < (int)S.size(); i++) {
		if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C' && i < (int)S.size() - 2) {
			count[3]++;
			i += 2;
		} else count[S[i] - 'A']++;
	}
	if (count[c] >= 1 || count[3] == 0) return 0;
	return 1;
}

int foo(string S) {
	int i = 3;
	if (huga(S))return 1;
	while (i--) {
		if (hoo(S, i)) if (foo(hoge(S, i))) return 1;
	}
	return 0;
}

int main() {
	string S;

	cin >> S;

	if (foo(S))cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}





Measured memory_bytes: 9428
//
//  main.cpp
//  zero
//
//  Created by 叶金炜 on 2019/4/2.
//  Copyright © 2019 okstal. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <string>
#define pi acos(-1)
using namespace std;
int main()
{
    double a,b,c,s,l,h;
    cin>>a>>b>>c;
    s=0.5*a*b*sin(c*2*pi/360);
    h=s*2/a;
    l=sqrt(a*a+b*b-2*a*b*cos(c*2*pi/360))+a+b;
    printf("%.5lf %.5lf %.5lf\n",s,l,h);
    return 0;
}



Measured memory_bytes: 3496
import java.io.BufferedInputStream
import java.io.InputStream
import java.util.StringTokenizer


fun solve(N: Long, A: Long, B: Long){
    println(Math.min(N * A, B))
    return
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toLong()
    val A = sc.next().toLong()
    val B = sc.next().toLong()
    solve(N, A, B)
}


Measured memory_bytes: 31508
#include<iostream>
#include<cmath>
#include<cctype>
#include<algorithm>
#include<cstring>
using namespace std;
int main(){
    int n;
    int d[105];
    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>d[i];
	}
    int s1=0,s2=0,ans=99999999;
	for(int i=1;i<=n;i++){
		s1=0;
		s2=0;
        for(int j=1;j<=n;j++){
			if(j>i){
				s2+=d[j];
			}
			else {
				s1+=d[j];
			}
		}
		ans=min(ans,abs(s1-s2));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	string s;
	cin >> s;

	int n = s.size();

	vector<int> alpcnt(26, 0);

	rep(i, n) alpcnt[s[i] - 'a']++;

	rep(i, 26){
		if(alpcnt[i] == 0){
			char c = 'a' + i;
			string ans{c};
			cout << ans << endl;
			return 0;
		}
	}

	cout << "None" << endl;
}


Measured memory_bytes: 512
N = int(input())
W = []
ans = True
for i in range(N):
    tmp = input()
    if tmp in W and i != 0:
        ans = False
    W.append(tmp)

if ans:
    last_word = W[0][-1]
    for i in range(1, N):
        if last_word != W[i][0]:
            ans = False
        last_word = W[i][-1]

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


Measured memory_bytes: 3060
import sys
input=sys.stdin.readline

import math

def main():
    N = int(input())
    T = A = 1
    for _ in range(N):
        t,a = map(int, input().split())
        k = max(-(-T//t),-(-A//a))
        T = k*t
        A = k*a
    print(T+A)

if __name__ == '__main__':
    main()


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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int sum = 0;

        while(true){

            //???????????¨??????????????????
            String x = br.readLine();
            //????????????????????????????´?
            char[] charKeta = x.toCharArray();

            //???????????¶
            if(x.equals("0")){
                break;
            }

            for(int i = 0; i < charKeta.length; i++){
                //char?????????int???????????£??????
                int intKeta = Character.getNumericValue(charKeta[i]);
                sum += intKeta;
            }
            System.out.println(sum);
            sum = 0;
        }
    }
}

Measured memory_bytes: 24256
n = int(input())
t = []
a = []
for i in range(n):
    t_i, a_i = map(int, input().split())
    t.append(t_i)
    a.append(a_i)

vt = t[0]
va = a[0]

for i in range(n):
    if (vt * a[i] == va * t[i]):
        continue
    
    if(vt * a[i] < va * t[i]):
        x = (va + a[i] - 1)//a[i]
    elif (vt * a[i] > va * t[i]):
        x = (vt + t[i] - 1)//t[i]
    vt = x * t[i]
    va = x * a[i]

ans = vt + va
print(ans)

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

int xyecoc (int i, int j, vector < pair < int, int > > &a, vector < pair < int, int > > &b) {
    if (i >= 0 && j >= 0) {
        if (a[i].second != b[j].second)
            return a[i].first + b[j].first;
        return 0;
    }
    return 0;
}

signed main () {
    int n;
    cin >> n;
    map < int, int > odd, even;
    int odd_cnt = 0, even_cnt = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (i & 1) {
            ++odd[x];
            ++odd_cnt;
        }
        else {
            ++even[x];
            ++even_cnt;
        }
    }
    vector < pair < int, int > > odd_prior, even_prior;
    for (auto pr: odd)
        odd_prior.push_back(make_pair(pr.second, pr.first));
    sort(odd_prior.begin(), odd_prior.end());
    for (auto pr: even)
        even_prior.push_back(make_pair(pr.second, pr.first));
    sort(even_prior.begin(), even_prior.end());
    int res = max({xyecoc(even_prior.size() - 1, odd_prior.size() - 1, even_prior, odd_prior), xyecoc(even_prior.size() - 1, odd_prior.size() - 2, even_prior, odd_prior), xyecoc(even_prior.size() - 2, odd_prior.size() - 1, even_prior, odd_prior)});
    if (res == 0)
        res = max(even_prior.back().first, odd_prior.back().first);
    cout << odd_cnt + even_cnt - res << '\n';
}


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

int main(void){
    string a, b;
    cin >> a >> b;
    
    if(a.length() > b.length()){
        cout << "GREATER" << endl;
    }else if(a.length() < b.length()){
        cout << "LESS" << endl;
    }else{
        for(int i = 0; i < a.length(); i++){
            if(a[i] > b[i]){
                cout << "GREATER" << endl;
                return 0;
            }else if(a[i] < b[i]){
                cout << "LESS" << endl;
                return 0;
            }
        }
        
        cout << "EQUAL" << endl;
    }
    
    return 0;
}


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

struct UnionFind {
	vector<int> par, sz;

	UnionFind(int N) : par(N), sz(N, 1) {
		iota(par.begin(), par.end(), 0);
	}

	int find(int v) {
		return (par[v] == v ? v : par[v] = find(par[v]));
	}

	void unite(int u, int v) {
		u = find(u), v = find(v);
		if (sz[u] < sz[v]) swap(u, v);
		par[v] = u;
		sz[u] += sz[v];
	}
};

struct Edge {
	int u, v, c;
	Edge(int u = 0, int v = 0, int c = 0) 
		: u(u), v(v), c(c){}
};

void compress(vector<int>& v) {
	vector<int> w = v;
	sort(w.begin(), w.end());
	w.erase(unique(w.begin(), w.end()), w.end());
	map<int, int> mp;
	for(int i = 0; i < w.size(); ++i) {
		mp[w[i]] = i;
	}
	for(auto& e : v) e = mp[e];
}

bool solve() {
	int N, M;
	cin >> N >> M;
	if (N == 0) return false;

	vector<int> H(N);
	for(auto& h : H) cin >> h;

	compress(H);
	int HMAX = *max_element(H.begin(), H.end());

	vector<Edge> edges(M);
	for(auto& e : edges) {
		cin >> e.u >> e.v >> e.c;
		--e.u, --e.v;
	}

	sort(edges.begin(), edges.end(), [](Edge a, Edge b){
		return a.c < b.c;
	});

	set<int> vs;
	int T = -1;
	for(int t = HMAX; t >= 0; --t) {
		bool upd = false;
		for(int v = 0; v < N; ++v) {
			if (H[v] == t) {
				vs.insert(v);
				upd = true;
			}
		}
		if (!upd) continue;

		UnionFind uf(N);
		for(auto e : edges) {
			if (vs.count(e.u) && vs.count(e.v)) {
				uf.unite(e.u, e.v);
			}
		}

		set<int> pars;
		for(auto v : vs) {
			pars.insert(uf.find(v));
		}

		if (pars.size() > 1) {
			T = -1;
		} else if (T < 0) {
			T = t;
		}
	}

	if (T < 0) {
		cout << 0 << endl;
		return true;
	}

	vs.clear();
	for(int v = 0; v < N; ++v) {
		if (H[v] >= T) vs.insert(v);
	}

	int ans = 0;
	UnionFind uf(N);
	for(auto e : edges) {
		if (vs.count(e.u) && vs.count(e.v) &&
			uf.find(e.u) != uf.find(e.v)) {
			uf.unite(e.u, e.v);
			ans += e.c;
		}
	}

	for(int t = T - 1; t >= 0; --t) {
		bool upd = false;
		for(int v = 0; v < N; ++v) {
			if (H[v] == t) {
				vs.insert(v);
				upd = true;
			}
		}
		if (!upd) continue;

		for(auto e : edges) {
			if (vs.count(e.u) && vs.count(e.v) &&
				uf.find(e.u) != uf.find(e.v)) {
				uf.unite(e.u, e.v);
				ans += e.c;
			}
		}
	}

	cout << ans << endl;
	return true;
}

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



Measured memory_bytes: 3408
#include<iostream>
#include<climits>
using namespace std;
int max_arr( int arr[], int size )
{
	int max=INT_MIN;
	for( int i=0; i<size; i++ ){
		max=( arr[i] > max )? arr[i] : max;
	}
	return max;
}
int min_arr( int arr[], int size )
{
	int min=INT_MAX;
	for( int i=0; i<size; i++ ){
		min=( arr[i] < min )? arr[i] : min;
	}
	return min;
}
int sum_arr( int arr[], int size) 
{
	int sum=0;
	for( int i=0; i<size; i++ ){
		sum+= arr[i];
	}
	return sum;
}


int canCarry( int carrylim, int t_num, int w[], int w_num ){

	int w_i=0;
	for( int t_i=0; t_i<t_num; t_i++ ){
			int wsum=0;
		for( ; w_i<w_num; w_i++ ){
			if( wsum + w[w_i] <= carrylim ){
				wsum+= w[w_i];
			}else{
				break;
			}
		}

		if( w_i==w_num ){
			return w_num;
		}
	}
	return w_i;
}
		
int solve(int w[], int w_num, int t_num ){
	int carrylim_left= max_arr(w, w_num)-1, carrylim_right=sum_arr(w, w_num), carrylim_middle;


	while( carrylim_right > carrylim_left+1 ){
		carrylim_middle= (carrylim_left + carrylim_right) /2;
		int cancarry= canCarry( carrylim_middle, t_num, w, w_num );

//		cout<<"??????????????§????????? : "<<carrylim_middle<<endl;
//		cout<<"??°?????????????????° : "<<cancarry<<endl;
//		cout<<endl;


		if( cancarry >= w_num ){
			carrylim_right= carrylim_middle;
		}else if( cancarry < w_num ){
			carrylim_left=  carrylim_middle;
		}
	}
	return carrylim_right;
}

		



int main()
{
	int w_num, t_num;
	cin>>w_num>>t_num;
	int *w=new int[w_num];
	for( int i=0; i<w_num; i++ ) cin>>w[i];

	cout<<solve(w, w_num, t_num)<<endl;
}

Measured memory_bytes: 1568
def satou(a,b):
    return 100 * b / (a+b)

a,b,c,d,e,f = map(int,input().split())
water = [-1 for j in range(f+2)]
sugar = [-1 for i in range(f+2)]
water[0] = 0
sugar[0] = 0

for i in range(f+1):
    if water[i] > -1:
        if i+100*a <= f :
            water[i+100*a] = i+100*a 
        if i+100*b <= f :
            water[i+100*b] = i+100*b
    if sugar[i] > -1:
        if i+c <= f :
            sugar[i+c] = i+c
        if i+d <= f :
            sugar[i+d] = i+d
w = list(set(water))
w.remove(-1)
w.remove(0)
s = list(set(sugar))
s.remove(-1)
s.remove(0)
#print(w,s)
mx = 0
ws = [100*a,0]
for i in w:
    for j in s:
        x = ((f-i) // j) * j
        y = ((e*i/100)//j) * j
        t = satou(i, min(x,y))
        if mx < t:
            mx = t
            ws = [i, min(x,y)]

print(int(sum(ws)), int(ws[1]))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e18;
const int inf=2e9;
const ll MOD=1000000007;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};

int main(){
    int N;cin>>N;
    int P[N],Q[N];
    rep(i,N)cin>>P[i];
    rep(i,N)cin>>Q[i];
    ll p=0,q=0;
    rep(i,N){
        if(i)p*=10;
        p+=P[i];
    }
    rep(i,N){
        if(i)q*=10;
        q+=Q[i];
    }
    vector<int> vec;
    rep(i,N)vec.push_back(i+1);
    ll count=1,countp,countq;
    do{
        ll k=0;
        rep(i,N){
            if(i)k*=10;
            k+=vec[i];
        }
        if(k==p)countp=count;
        if(k==q)countq=count;
        count++;
    }while(next_permutation(vec.begin(),vec.end()));
    cout<<abs(countp-countq)<<endl;
    return 0;
}

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

using namespace std;

int main(){
    int N;
    cin>>N;
    vector<double> v(N);
    long T,A;
    cin>>T>>A;

    for(int i=0;i<N;++i){
        cin>>v[i];
        v[i]=fabs((double)A-(T-v[i]*0.006));
    }
    long ans=0;
    for(int i=1;i<N;++i){
        if(v[ans]>v[i]){
            ans=i;
        }
    }

    cout<<ans+1<<endl;
}



Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N;
std::string s;
int a, b, c;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >>N>> s;
	
	if (std::count(s.begin(), s.end(), 'R') > N/2) {
		out << "Yes" << endl;
	}
	else {
		out << "No" << endl;
	}

	return 0;
}
#endif


Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.begin(), c.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
#define Sort(a) sort(Range(a));
#define DeSort(a) sort(RevRange(a));

using namespace std;
using ll = long long;

int main(void){
    Cin(int, a);
    Cin(int, b);
    Cin(int, c);
    Cin(int, d);
    Cout(a*(a+1)/2);
    //Cout(() ? "Yes" : "No");
    //Cout(() ? "YES" : "NO");
}

Measured memory_bytes: 256
n = int(input())
task = [list(map(int, input().split())) for i in range(n)]
# print(n)
# print(task)
import numpy as np
task = np.array(task)
# print(task[:,1])
# print(np.argsort(task[:,1]))
newtask = task[np.argsort(task[:,1])]
# print(newtask)
t = 0
for i in range(n):
    t += newtask[i,0]
    if t > newtask[i,1]:
        print("No")
        exit()
print("Yes")

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

const int MOD = 1e9+7, MAX_N = 300006;
int N;
ll A[MAX_N];
ll bit0[70], bit1[70]; // how many 0's and 1's have we seen at bit i

void solve()
{
    ll x = A[N-1];
    for(int i=0;i<62;++i){
        if(x>>i&1) bit1[i]++;
        else bit0[i]++;
    }
    ll res = 0;
    for(int i=N-2;i>=0;--i){
        ll x = A[i];
        for(int j=0;j<62;++j){
            if(x>>j&1) res = (res + (bit0[j]%MOD)*((1LL << j)%MOD))%MOD, bit1[j]+=1;
            else res = (res + (bit1[j]%MOD)*((1LL << j)%MOD))%MOD, bit0[j]+=1;
        }
    }
    cout << res << "\n";
}

int main()
{
	cin >> N;
	for(int i=0;i<N;++i) cin >> A[i];
	solve();
	return 0;
}

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

using namespace std;

//struct edge{
//  int to;
//};

set<int> tree[100001];
int path[100001];
int visit[100001];
int Fnode,Snode;

void findBoundNode(int node,int depth, int N) {
  if (Fnode!=0&&Snode!=0)return ;
  path[depth]=node;
  //  cout<<"visited"<<node<<endl;
  if (node == N) {
    int L = depth / 2;
    int R = L + 1;
    Fnode = path[L];
    Snode = path[R];
    return ;
  }
  for (set<int>::iterator it = tree[node].begin();it!=tree[node].end();it++) {
    if (depth==0||*it!=path[depth-1])
      findBoundNode(*it,depth+1,N);
  }
}

int nodeCount(int node, int par, int forbidden) {

  int sum =1;

  for (set<int>::iterator it = tree[node].begin();it!=tree[node].end();it++) {
    if (*it!=forbidden && *it!=par) {
      sum += nodeCount(*it, node, forbidden);
    }
  }
  return sum;
}


int main() {

  int N;
  cin>>N;
  for(int i=0;i<N-1;i++){
    int a,b;
    cin>>a>>b;
    tree[a].insert(b);
    tree[b].insert(a);
  }


  findBoundNode(1,0,N);

  int Fcount = nodeCount(1,0,Snode);
  int Scount = nodeCount(N,0,Fnode);
  //  cout << Fnode  << " " << Snode  << endl;
  //  cout << Fcount << " " << Scount << endl;

  if (Fcount > Scount)
    cout << "Fennec" << endl;
  else
    cout << "Snuke" <<endl;

  return 0;
}


Measured memory_bytes: 20992
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
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; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
const double pi=3.1415926535897932384626;
bool IsPrime(ll num)//素数
{
    if (num < 2ll) return false;
    else if (num == 2ll) return true;
    else if (num % 2ll == 0ll) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3ll; i <= sqrtNum; i += 2ll)
    {
        if (num % i == 0ll)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
int main(){
    ll n;
    
    std::cin >> n;
    ll nn=n;
    std::vector<ll> d;
    rrep(i,2,sqrt(n)+13){
        if(n%i==0&&IsPrime(i))d.pb(i);
        while(nn%i==0)nn/=i;
    }
    if(nn!=1)d.pb(nn);
    erep(i,d){
   //     std::cout << i << std::endl;
        n*=(i-1);
        n/=i;
    }
    std::cout << n << std::endl;
}


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

int main() {
    int64_t X;
    std::cin >> X;

    int64_t cnt1 = X / 500;
    X %= 500;

    int64_t cnt2 = X / 5;
    std::cout << cnt1 * 1000 +  cnt2 * 5 << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 1e5;
int N;
ll A[Nmax];

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

	vector<int> c(4);
	for(int i=0; i<N; i++) c[A[i]%4] += 1;

	if((c[2]==0 && c[1]+c[3] <= c[0]+1) ||
			(c[1]+c[3] <= c[0]))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
typedef long long ll;
const long long llinf=LLONG_MAX;
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
using namespace std;
int n,x,mx,i,cnt[101];
int main()
{
	//freopen("sol.in","r",stdin);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=n;i++)cin>>x,cnt[x]++,mx=max(mx,x);
	for(i=mx;i>=(mx+1)/2+1;i--)if(cnt[i]<2)rc("Impossible");
	if(cnt[(mx+1)/2]!=1+mx%2)rc("Impossible");
	for(i=(mx+1)/2-1;i>=1;i--)if(cnt[i])rc("Impossible");
	rc("Possible");
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
int main() {
	char a, b, c;
	cin >> a >> b >> c;
	if (a == b && b == c) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    string s; cin >> s;
    int count = 0;
    REP(i, 0, s.size()){
        if(s[i] == 'o'){
            count++;
        }
    }
    if(count + 15-s.size() >= 8){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3600
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        String ans = "x";
        
        for(int i = 1; i < num.length(); i++){
            ans = ans + "x";
        }
        
        System.out.println(ans);
    }
}

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

int main(){
  int N, H, W;
  cin >> N >> H >> W;
  int ans=0;
  for(int i=0; i<N; i++){
    int A, B;
    cin >> A >> B;
    if(A>=H && B>=W) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = gets.to_i
s = gets.chomp

num = Array.new(10) {Array.new(10) {Array.new(10) + [false]} + [false]}
ans = 0

(n-2).times do |i|
    si = s[i].to_i
    next if num[si][-1]
    num[si][-1] = true
    
    (i+1).upto(n-2) do |j|
        sj = s[j].to_i
        next if num[si][sj][-1]
        num[si][sj][-1] = true

        (j+1).upto(n-1) do |k|
            sk = s[k].to_i
            next if num[si][sj][sk]
            num[si][sj][sk] = true
            
            ans += 1
        end
    end
end

puts ans

Measured memory_bytes: 1916
a = 3.times.map{gets.split.map(&:to_i)}
gets.to_i.times do
  b = gets.to_i
  3.times do |i|
    3.times do |j|
      a[i][j] = 0 if a[i][j] == b
    end
  end
end

ok = false
3.times do |i|
  ok ||= 3.times.all?{|j| a[i][j] == 0}
end
3.times do |i|
  ok ||= 3.times.all?{|j| a[j][i] == 0}
end

ok ||= 3.times.all?{|i| a[i][i] == 0}
ok ||= [a[0][2], a[1][1], a[2][0]].uniq == [0]

puts ok ? 'Yes' : 'No'


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <cfenv>
#include <cmath>
using namespace std;

int main() {
  int a,b;
  cin >> a >> b;
  int x = -1;
  for (int i = 1; i <= 1250; ++i) {
    if ( floor(i * 0.08) == a && floor(i * 0.1) == b) {
      x = i;
      break;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val Seq(args1, args2) : Seq[Int] = readLine split " " map(_.toInt)
    val area =  args1 * args2
    val length = args1 * 2 + args2 * 2 
    println (area + " " + length) 
  }
}

Measured memory_bytes: 43684
A, B, C = map(int, input().split())
D = [0 for _ in range(B)]
for i in range(B):
    D[i] = (A * (i + 1)) % B
    if D[i] == C:
        ans = 'YES'
        break
    else:
        ans = 'NO'
print(ans)


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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 2e5;
int n, k, a[nsz + 5];
num ans;

int main() {
	ios::sync_with_stdio(0);
	cin >> n >> k;
	cont (i, n) {
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	cont (i, n - k) {
		ans += a[i];
	}
	cout << ans << ln;
}

Measured memory_bytes: 1024
#pragma region Macros
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

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 T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

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

  int n;
  cin >> n;
  int logn = log2(n);
  vector<vector<int>> next(logn + 1, vector<int>(n, -1));
  vector<int> depth(n, 0);
  // next[0][0] = -1;
  REP(i, n) {
    int k;
    cin >> k;
    REP(j, k) {
      int c;
      cin >> c;
      next[0][c] = i;
      depth[c] = depth[i] + 1;
    }
  }

  REP(k, logn) {
    REP(i, n) {
      if (next[k][i] == -1) {
        next[k + 1][i] = -1;
      } else {
        next[k + 1][i] = next[k][next[k][i]];
      }
    }
  }

  int q;
  cin >> q;
  REP(i, q) {
    int u, v;
    cin >> u >> v;
    if (depth[u] > depth[v]) {
      int Q = depth[u] - depth[v];
      for (int k = logn - 1; k >= 0; k--) {
        if ((Q >> k) & 1) {
          u = next[k][u];
        }
      }
    } else if (depth[u] < depth[v]) {
      int Q = depth[v] - depth[u];
      for (int k = logn; k >= 0; k--) {
        if ((Q >> k) & 1) {
          v = next[k][v];
        }
      }
    }

    if (u == v) {
      cout << u << '\n';
      continue;
    }

    for (int k = logn - 1; k >= 0; k--) {
      if (next[k][u] != next[k][v] and next[k][u] != -1 and next[k][v] != -1) {
        u = next[k][u];
        v = next[k][v];
      }
    }
    cout << next[0][u] << '\n';
  }

  return 0;
}


Measured memory_bytes: 10176
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll a, b, c;
	cin >> a >> b >> c;
	if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0) cout << 0 << endl;
	else cout << min({a * b, a * c, b * c}) << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		int t = sc.nextInt();
		int s = sc.nextInt();
		
		String ans = t * s >= d ? "Yes" : "No";
		System.out.println(ans);

		sc.close();
	}
}




Measured memory_bytes: 27076