akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] G = new int[n][n];
		
		for (int i = 0; i < n; i++) {
			int u = sc.nextInt();
			int k = sc.nextInt();
			for (int j = 0; j < k; j++) {
				int v = sc.nextInt();
				G[u][v] = sc.nextInt();
			}
		}
		solve(n, G);
	}
	
	public static void solve(int n, int[][] G) {
		int[] dist = new int[n]; // 確定した距離
		int[] cand = new int[n]; // 候補
		
		int s = 0;
		int count = n;
		while(count > 0) {
			for (int i = 1; i < n; i++) {
				if (G[s][i] == 0)
					continue;
				if (cand[i] > 0)
					cand[i] = Math.min(G[s][i] + dist[s], cand[i]);
				else 
					cand[i] = G[s][i] + dist[s];
			}
			
			int minI = Integer.MAX_VALUE;
			int minD = Integer.MAX_VALUE;
			for (int i = 1; i < n; i++) {
				if (i == s)
					continue;
				if (dist[i] > 0)
					continue;
				if (cand[i] == 0) {
					continue;
				}
				if (cand[i] < minD) {
					minI = i;
					minD = cand[i];
				}
			}
			if (minI != Integer.MAX_VALUE)
				dist[minI] = minD;
			// next
			s = minI;
			count--;
		}
		for (int i = 0; i < n; i++) {
			System.out.println(i + " " + dist[i]);
		}
	}
}

Measured memory_bytes: 31916
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

ll a[15];
void solve() {
	int n, k; cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
	}
	ll mi = INF;
	rep(i, (1 << n)) {
		vector<int> v;
		rep(j, n) {
			if (i&(1 << j)) {
				v.push_back(j);
			}
		}
		if (v.size() < k)continue;
		ll sum = 0;
		ll le = 0;
		rep(j, n) {
			if (i&(1 << j)) {
				if (le >= a[j]) {
					sum += le - a[j] + 1;
					le++;
				}
				else {
					le =a[j];
				}
			}
			else {
				le = max(le, a[j]);
			}
		}
		mi = min(mi, sum);
	}
	cout << mi << endl;
}
int main() {
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


const int max_comb=300000;
vector<ll> fac(max_comb+1); //n! (mod M)
vector<ll> ifac(max_comb+1); //k!^(-1) (mod M)

ll mpow(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll minv(ll x){
    return mpow( x, MOD-2 );
}

ll comb(int a, int b){     // C(a,b) = a! * b!^(-1) * (a-b)^(-1)
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

ll perm(int a, int b){     // P(a,b) = a! * (a-b)!^(-1)
    if(b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b] % MOD;
    return tmp * fac[a] % MOD;
}

void pre_comb()
{
    fac[0] = 1;
    ifac[0] = 1;
    for(int i = 0; i<max_comb; i++){
        fac[i+1] = fac[i]*(i+1) % MOD; // n!(mod M)
        ifac[i+1] = ifac[i]*minv(i+1) % MOD; // k!^(-1) (mod M)
    }
    return;
}

int main(int argc, char* argv[])
{
    int x,y;
    scanf("%d%d", &x, &y);
    if((x+y)%3!=0) {
        printf("0\n"); return 0;
    }

    int m=(x+y)/3;
    int q=x-m;
    if(q<0 || q>m) {
        printf("0\n"); return 0;
    }

    ll ans=1;
    int i;
    for(i=m; i>m-q; i--) {
        ans=ans*i%MOD;
    }
    for(i=1; i<=q; i++) {
        ans=ans*minv(i)%MOD;
    }
    printf("%lld\n", ans);

    return 0;
}


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

using namespace std;

int main(){
  string s;
  cin >> s;
  bool good = true;
  for(int i = 0; i < 3; i++)
    if( s[i] == s[i+1] )
      good = false;
  if( good )
    cout << "Good" << endl;
  else
    cout << "Bad" << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque

def main():
    h, w = map(int, input().split())
    maze = [input() for i in range(h)]
    # 行ったかどうかのフラグ
    visited = [[-1]*w for j in range(h)]
    start_yx = []
    for i in range(h):
        for j in range(w):
            if maze[i][j] == '.':
                sy = i
                sx = j
                start_yx .append([sy, sx])

    # 移動パターン
    mv = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    ans = 0
    for sy, sx in start_yx :
        visited = [[-1]*w for j in range(h)]
        q = deque([[sy, sx]])
        visited[sy][sx] = 0 
        while q:
            y, x = q.popleft()
            ans = max(ans, visited[y][x])
            for i, j in mv:
                if (0 <= y + i < h) and (0 <= x + j < w):  
                    ny = y+i
                    nx = x+j
                    if visited[ny][nx] != -1:
                        continue
                    if maze[ny][nx] == '.':
                        visited[ny][nx] = visited[y][x] + 1 
                        q.append([ny, nx])
                else:
                    continue
    print(ans)

if __name__ == '__main__':
    main()




Measured memory_bytes: 9340
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<string,ll> P;
#define M 1000000007
int main(){
  ll n,l;
  cin>>n;
  vector<P> p(n),q(n);
  map<P,ll> m;
  string s;
  for(ll i=0;i<n;i++){
    cin>>s>>l;
    p[i]=P(s,-l);
    q[i]=p[i];
    m[p[i]]=i+1;
  }
  sort(p.begin(),p.end());
  for(int i=0;i<n;i++){
    cout<<m[p[i]]<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int A1, A2, A3;
	cin >> A1 >> A2 >> A3;

	int A = A1 + A2 + A3;

	if (A >= 22) {
		cout << "bust" << endl;
	}
	else {
		cout << "win" << endl;
	}
	
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
unsigned long long n,num,x[20];
unsigned long long moli(unsigned long long n ,unsigned long long num,unsigned long long num1)
{
	if(n==1)
	{
		return 2*num+num1+x[n]+num1*10+x[n];
	}
	return moli(n-1,num,num1*10+x[n])+moli(n-1,num+num1,x[n]);
}
int main()
{
	cin>>n;
	while(n)
	{
		num++;
		x[num]=n%10;
		n/=10;
	}
	cout<<moli(num,0,0)/2<<endl;
	return 0;
}  

Measured memory_bytes: 256
import heapq

def main():
    buf = input()
    buflist = buf.split()
    X = int(buflist[0])
    Y = int(buflist[1])
    Z = int(buflist[2])
    K = int(buflist[3])
    buf = input()
    buflist = buf.split()
    A = list(map(int, buflist))
    buf = input()
    buflist = buf.split()
    B = list(map(int, buflist))
    buf = input()
    buflist = buf.split()
    C = list(map(int, buflist))
    A = list(sorted(A, reverse=True))
    B = list(sorted(B, reverse=True))
    C = list(sorted(C, reverse=True))
    cakeheap = [(-(A[0]+B[0]+C[0]), 0, 0, 0)]
    hashtable = {(-(A[0]+B[0]+C[0]), 0, 0, 0)}
    tastiness = []
    while len(tastiness) < K:
        current = heapq.heappop(cakeheap)
        tastiness.append(-current[0])
        if current[1] < len(A)-1:
            if (-(A[current[1]+1]+B[current[2]]+C[current[3]]), current[1]+1, current[2], current[3]) not in hashtable:
                heapq.heappush(cakeheap, (-(A[current[1]+1]+B[current[2]]+C[current[3]]), current[1]+1, current[2], current[3]))
                hashtable.add((-(A[current[1]+1]+B[current[2]]+C[current[3]]), current[1]+1, current[2], current[3]))
        if current[2] < len(B)-1:
            if (-(A[current[1]]+B[current[2]+1]+C[current[3]]), current[1], current[2]+1, current[3]) not in hashtable:
                heapq.heappush(cakeheap, (-(A[current[1]]+B[current[2]+1]+C[current[3]]), current[1], current[2]+1, current[3]))
                hashtable.add((-(A[current[1]]+B[current[2]+1]+C[current[3]]), current[1], current[2]+1, current[3]))
        if current[3] < len(C)-1:
            if (-(A[current[1]]+B[current[2]]+C[current[3]+1]), current[1], current[2], current[3]+1) not in hashtable:
                heapq.heappush(cakeheap, (-(A[current[1]]+B[current[2]]+C[current[3]+1]), current[1], current[2], current[3]+1))
                hashtable.add((-(A[current[1]]+B[current[2]]+C[current[3]+1]), current[1], current[2], current[3]+1))
    for i in tastiness:
        print(i)


if __name__ == '__main__':
    main()


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  while(A>0&&C>0){
    C=C-B;
    if(C<1){
      cout << "Yes" << endl;
      break;
    }
    A=A-D;
    if(A<1){
      cout << "No" << endl;
      break;
    }
  }
}


Measured memory_bytes: 3608
package main

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

var sc = bufio.NewScanner((os.Stdin))

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	l := nextLine()
	i, e := strconv.Atoi(l)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N, M := nextInt(), nextInt()
	P, Y := []int{}, []int{}
	for i := 0; i < M; i++ {
		P = append(P, nextInt())
		Y = append(Y, nextInt())
	}

	//fmt.Printf("%s\n", ABC113C(N, M, P, Y))
	ABC113C(N, M, P, Y)
}

// City ...
type City struct {
	i   int
	p   int
	y   int
	cid int
}

// ABC113C ...
func ABC113C(N, M int, P, Y []int) string {
	cties := []City{}
	for i := 0; i < M; i++ {
		cties = append(cties, City{i, P[i], Y[i], -1})
	}

	sort.Slice(cties, func(i, j int) bool {
		if cties[i].p < cties[j].p {
			return true
		} else if cties[i].p == cties[j].p {
			if cties[i].y < cties[j].y {
				return true
			}
		}
		return false
	})

	ccid, lastPid := 0, 0
	for i := 0; i < len(cties); i++ {
		if cties[i].p != lastPid {
			lastPid = cties[i].p
			ccid = 1
			cties[i].cid = ccid
		} else {
			ccid++
			cties[i].cid = ccid
		}
	}

	sort.Slice(cties, func(i, j int) bool {
		if cties[i].i < cties[j].i {
			return true
		}
		return false
	})

	for _, c := range cties {
		fmt.Printf("%06d%06d\n", c.p, c.cid)
	}

	return ""
}


Measured memory_bytes: 19188
object Main extends App {
  import scala.io.StdIn._
  val Array(n, q) = readLine.trim.split(' ').map(_.toInt)
  val str = readLine.trim.toCharArray
  val factor = (1 until n).filter(i ⇒ n % i == 0).toArray
  val countSubString = factor.map(f ⇒ Array.fill(f){Array.fill(26){0}})
  val countRepeating = factor.map(_ ⇒ 0)
  for (i ← str.indices) {
    for (j ← factor.indices) {
      countSubString(j)(i % factor(j))(str(i) - 'a') += 1
      if (countSubString(j)(i % factor(j))(str(i) - 'a') == n / factor(j)) {
        countRepeating(j) += 1
      }
    }
  }
  for (_ ← 0 until q) {
    readLine.trim.split(' ') match {
      case Array(p, to) ⇒
        val pos = p.toInt - 1
        var minLength = n
        for (j ← factor.indices) {
          countSubString(j)(pos % factor(j))(str(pos) - 'a') -= 1
          if (countSubString(j)(pos % factor(j))(str(pos) - 'a') == n / factor(j) - 1) {
            countRepeating(j) -= 1
          }
          countSubString(j)(pos % factor(j))(to.head - 'a') += 1
          if (countSubString(j)(pos % factor(j))(to.head - 'a') == n / factor(j)) {
            countRepeating(j) += 1
          }
          if (countRepeating(j) == factor(j)) {
            minLength = math.min(minLength, factor(j))
          }
        }
        str(pos) = to.head
        println(minLength)
      case _ ⇒ ???
    }
  }
}


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

#define all(x) (x).begin(), (x).end() //sortなどの引数を省略したい

typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1000000;
const int minf = -1000000;
const ll lnf = 1e12;
const ll mlnf = -1e12;

// Graph problem
using Graph = vector<vector<int>>;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

// solve
// 最短経路を通り，通った道以外を黒にすれば良い
int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> field(H);
    for (int i = 0; i < H; i++) {
        cin >> field[i];
    }
    queue<pair<int, int>> que;
    vector<vector<pair<int, int>>> dist(H, vector<pair<int, int>>(W, { -1, -1 }));
    que.push({ 0, 0 });
    while (!que.empty()) {
        pair<int, int> tmp;
        tmp = que.front();
        int h = tmp.first;
        int w = tmp.second;
        que.pop();
        for (int i = 0; i < 4; i++) {
            int nh = h + dx[i];
            int nw = w + dy[i];
            if (nh < 0 || H <= nh || nw < 0 || W <= nw)
                continue;
            if (field[nh][nw] == '#')
                continue;
            if (dist[nh][nw].first != -1)
                continue;
            que.push({ nh, nw });
            dist[nh][nw].first = h;
            dist[nh][nw].second = w;
        }
    }
    if (dist[H - 1][W - 1].first == -1) {
        printf("%d\n", -1);
        return 0;
    }
    // 最短経路の復元
    vector<vector<char>> route(H, vector<char>(W, 'x'));
    route[0][0] = 'o';
    route[H - 1][W - 1] = 'o';
    int h = H - 1;
    int w = W - 1;
    while (h != 0 || w != 0) {
        route[dist[h][w].first][dist[h][w].second] = 'o';
        int tmp1 = dist[h][w].first;
        int tmp2 = dist[h][w].second;
        h = tmp1;
        w = tmp2;
    }
    int ans = 0;
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            if (field[h][w] == '.' && route[h][w] == 'x')
                ans++;
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

using namespace std;
typedef long long ll;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second


int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll x,n=5,ans=0;
        while(n--)
        {
            cin>>x;
            if(!x) ans=n;
        }
        cout<<5-ans;
    }
    return 0;
}


Measured memory_bytes: 3660
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int X;
  cin>>X;
  string S="NO";
  if(X==3||X==5||X==7) S="YES";
  cout<<S<<endl;
return 0;}

Measured memory_bytes: 3588
# -*- coding: utf-8 -*-

import sys
from math import atan2, degrees, radians, sqrt, sin, cos

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bisearch_max(mn, mx, func):
    """ 条件を満たす最大値を見つける二分探索(小数用) """

    ok = mn
    ng = mx
    for _ in range(100):
        mid = (ok+ng) / 2
        if func(mid):
            # 上を探しに行く
            ok = mid
        else:
            # 下を探しに行く
            ng = mid
    return ok

a, b, x = MAP()
# 体積を面積にしておく
h = b * (x / (a * a * b))
S = a * h

# コップの底をh1の高さにした時、溢れるかどうか
def calc(h1):
    # 傾けた下の地面の長さ
    c = sqrt(a**2 - h1**2)
    # 傾けた角度
    dig1 = degrees(atan2(h1, c))
    # 傾けた反対側の角度
    dig2 = 90 - dig1
    if dig2 == 0:
        return False
    # カップの上の先端の低い方の高さ
    h2 = b * sin(radians(dig2))
    # 底の高い方よりカップの先端が高い位置にある
    if h2 >= h1:
        # 水面の横の長さ
        d = a / cos(radians(dig1))
        # 下の方の面積
        S1 = d * h1 / 2
        # この時点でSのが小さければOK
        if S1 >= S:
            return True
        # 上の方の面積
        S2 = S - S1
        # 上の方の水の高さ
        h3 = S2 / d
        # 水面の高さがカップの先端より低ければOK
        return h1 + h3 <= h2
    # 底の高い方よりカップの先端が低い位置にある
    else:
        # 溢れるギリギリの水面の長さ
        e1 = b / cos(radians(dig2))
        # 面積と高さから、実際の水面の長さ
        e2 = S / h2 * 2
        return e2 <= e1

h = bisearch_max(0, a, calc)
w = sqrt(a**2 - h**2)
print(degrees(atan2(h, w)))


Measured memory_bytes: 3316
#include <stdio.h>

int main()
{
  int ret, i, j;
  int L, R;
  int modL, modR;
  int modMin, modTmp;

  ret = scanf("%d %d", &L, &R);
  modL = L % 2019;
  modR = R % 2019;
  if ( modL > modR ) {
    printf("0\n");
    return 0;
  }
  if ( (L / 2019) != (R / 2019) ) {
    printf("0\n");
    return 0;
  }
  if ( modL <= 673 && modR >= 673 ) {
    for ( i=modL; i<=modR; i++ ) {
      if ( i % 3 == 0 ) {
        printf("0\n");
        return 0;
      }
    }
  }
#if 0
  printf("modL = %d, modR = %d\n", modL, modR);
#endif
  modMin = 2019;
  for ( i=modL; i<modR; i++ ) {
    for ( j=i+1; j<=modR; j++ ) {
      modTmp = (i * j) % 2019;
      if ( modMin > modTmp )
        modMin = modTmp;
    }
  }
  printf("%d\n", modMin);
  return 0;
}


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

ll N;
ll A[3][3];
bool c[3][3];

int main() {
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> A[i][j];
        }
    }
    memset(c, false, sizeof(c));
    cin >> N;
    for (int i = 0; i < N; i++) {
        int b;
        cin >> b;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (A[i][j] == b) {
                    c[i][j] = true;
                }
            }
        }
    }

    bool ans = false;
    for (int i = 0; i < 3; i++) {
        if (c[i][0] && c[i][1] && c[i][2]) ans = true;

        if (c[0][i] && c[1][i] && c[2][i]) ans = true;

        if (c[0][0]&&c[1][1] &&  c[2][2]) ans = true;

        if (c[2][0]&&c[1][1] &&  c[0][2]) ans = true;
    }
    
    cout << (ans ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
x=int(input())
i,j=2,1
ans=[]
if x==1:
    print(1)
    quit()
while True:
    j+=1
    if i**j>x:
        i+=1
        j=2
        if i**j>x:
            break
    ans.append(i**j)
print(max(ans))

Measured memory_bytes: 3060
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): { A: number, B: number } => {
  const [A, B] = lines[0].split(' ').map(line => +line)
  const obj = { A, B }
  debug(obj)
  return obj
}
// solver
export const solve = (lines: string[]): string => {
  const { A, B } = parseLines(lines)
  const K = A / 2 + B / 2
  if (Number.isInteger(K)) {
    return `${K}`
  } else {
    return 'IMPOSSIBLE'
  }
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}


Measured memory_bytes: 7500
#　N：スキル数、M:本の数、X：達成したい習熟度
N,M,X=list(map(int,input().split()))
A =[]
C =[]
for n in range(N):
    input_temp=list(map(int,input().split()))
    C.append(input_temp[0])
    A.append(input_temp[1:])

def get_sum_list(bag):
    sum_list=[0]*M
    for b in bag:
        sum_list=[a + b for a, b in zip(sum_list,b)]
    return sum_list

#各本を買うかをbit全探索
ans = []
for n in range(2**N):
    bag = []
    charge = 0
    for j in range(N):
        if ((n >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            bag.append(A[j]) 
            charge += C[j]
    sum_list=get_sum_list(bag)
    
    if min(sum_list) >= X:
        ans.append(charge)
        
#     print(bag,sum_list,ans)
    
if len(ans)>0:
    print(min(ans))
else:
    print(-1)

Measured memory_bytes: 68704
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1


N=int(input())

def COMinit(n,MOD):
    fac,finv,inv=[0]*max(2,n+1),[0]*max(2,n+1),[0]*max(2,n+1)
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,(n+1)):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv

fac,finv,inv=COMinit(N,MOD)

def COM(n, k, MOD=MOD):
    if n<k or n<0 or k<0:
        return 0
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD


ans=0
for k in range(2,N+1):
    ans+=COM(N,k)*(pow(2,k,MOD)-2)*pow(8,N-k,MOD)
    ans%=MOD
print(ans)

Measured memory_bytes: 107252
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int i,j,n,num=0,top=1000;
    char a[2000]= {0};
    string s;
    cin>>n>>s;
    for(i=1000; i<n+1000; i++)
        a[i]=s[i-1000];
    for(i=1000; i<n+1000; i++)
    {
        if(a[i]=='(')
            num++;
        else if(num<=0)
            a[--top]='(';
        else
            num--;
    }
    if(num!=0)
        for(i=n+1000; i<n+1000+num; i++)
            a[i]=')';
    for(i=top; i<n+1000+num; i++)
        cout<<a[i];
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
int A[1111];

signed main(){
    cin>>N;
    rep(i,N)cin>>A[i];
    sort(A,A+N);

    double ma=0.0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            int sum=0,cnt=0;
            for(int k=N-1;k>=0;k--){
                if(i==k||j==k)continue;
                sum+=A[k];
                cnt++;
                if(cnt==2)break;
            }
            chmax(ma,1.0*sum/(A[j]-A[i]));
        }
    }

    printf("%.20f\n",ma);
}

Measured memory_bytes: 3220
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
        ll n;cin>>n;
	string s;cin>>s;
	if(s.length()==1)
	{
		cout<<1<<endl;
		return 0;
	}
	ll ans=0;bool flag=0;
	ll i=0;
	vi v;
	rep(i,0,s.length())
	{
		if(v.size()==0)
		v.pb(s[i]-'a');
		else
		{
			if(*v.rbegin()==(s[i]-'a'))
			continue;
			v.pb(s[i]-'a');
		}
	}
	cout<<v.size()<<endl;
}

Measured memory_bytes: 1480
#include <iostream>
#include <unordered_map>

int main(int argc, char *argv[]) {
  int n;
  std::cin >> n;
  std::unordered_map<int, int> a;
  for (int i = 1; i <= n; ++i)
    a.insert({i, 0});
  int x;
  while (std::cin >> x) {
    ++a.at(x);
  }

  for (int i = 1; i <= n; ++i) {
    std::cout << a.at(i) << std::endl;
  }
}


Measured memory_bytes: 10708
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int n,m,tot,sum[1200][1200];
int a[320][320];
int b[320][320];
char s[320];
long long ans;
int cal(){
	memset(sum,0,sizeof(sum));
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)sum[i+j][j]=a[i][j];
	for(int i=1;i<=n+m;i++)
		for(int j=1;j<=m;j++)sum[i][j]+=sum[i][j-1];
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			for(int k=1;k<=min(i-1,j-1);k++){
				if(a[i][j-k]&&a[i-k][j])
					ans+=sum[i+j+k][min(j+k,m)]-sum[i+j+k][j-1];
			}
		}
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			for(int k=2;i+k-1<=n&&j+k-1<=m&&j-k+1>=1;k++)
				if(a[i][j-k+1]&&a[i][j+k-1]&&a[i+k-1][j])
					ans--;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%s",s+1);
		for(int j=1;j<=m;j++)a[i][j]=s[j]=='#';
	}
	cal();
	memset(b,0,sizeof(b));
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)b[j][n-i+1]=a[i][j];	
	memcpy(a,b,sizeof(b));
	swap(n,m);
	cal();
	memset(b,0,sizeof(b));
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)b[j][n-i+1]=a[i][j];	
	memcpy(a,b,sizeof(b));
	swap(n,m);
	cal();
	memset(b,0,sizeof(b));
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)b[j][n-i+1]=a[i][j];		
	memcpy(a,b,sizeof(b));
	swap(n,m);
	cal();
	printf("%d\n",ans);
}

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


int main(){
    int n; cin >> n;
    map<string,vector<pair<int,int>>> a;
    string tmp;
    vector<string> stmp;
    int itmp;
    rep(i,n){
        cin >> tmp >> itmp;
        stmp.push_back(tmp);
        a[tmp].push_back(make_pair(itmp,i+1));
    }
    
    sort(stmp.begin(),stmp.end());
    vector<string> st(1);
    st[0] = stmp[0];
    int j = 0;
    for(int i = 0; i < stmp.size()-1;i++){
        if(stmp[i+1] != st[j]){
            st.push_back(stmp[i+1]);
            j++;
        }
    }

    for(string s:st){
        sort(a[s].begin(),a[s].end(),greater<pair<int,int>>());
    }
    
    for(string s:st){
        for(int i = 0; i < a[s].size(); i++){
            cout << a[s][i].second << endl;
        }
    }

}

Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        s: String,
    }

    let mut it = (&s).chars();
    // 0 start
    let mut ans_0 = 0;
    loop {
        match it.next() {
            Some('0') => (),
            Some('1') => ans_0+=1,
            None => break,
            _ => unreachable!(),
        }
        match it.next() {
            Some('1') => (),
            Some('0') => ans_0+=1,
            None => break,
            _ => unreachable!(),
        }
    }
    // 1 start
    it = (&s).chars();
    let mut ans_1 = 0;
    loop {
        match it.next() {
            Some('1') => (),
            Some('0') => ans_1+=1,
            None => break,
            _ => unreachable!(),
        }
        match it.next() {
            Some('0') => (),
            Some('1') => ans_1+=1,
            None => break,
            _ => unreachable!(),
        }
    }

    println!("{}", std::cmp::min(ans_0, ans_1))
}


Measured memory_bytes: 2328
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

int a[100010], b[100010], c[100010];
signed main(void)
{
  int n, l;
  cin >> n >> l;
  REP(i, n) cin >> a[i];

  REP(i, n-1) {
    if(a[i] + a[i+1] >= l) {
      cout << "Possible" << endl;
      REP(j, i) cout << j+1 << endl;
      for(int j=n-1; j>=i+1; --j) cout << j << endl;
      // cout << i+1 << endl;
      return 0;
    }
  }
  cout << "Impossible" << endl;

  return 0;
}


Measured memory_bytes: 1152
#include <stdio.h>
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<complex>
#include<vector>

using namespace std;

int nx[]={0,1,0,-1};
int ny[]={0,1,0,-1};
//*****************************************


int main(void){

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

    cout << a*b/2;

    return 0;
}





Measured memory_bytes: 256
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
H = list(map(int, input().split()))
A = list(map(int, input().split()))
# ---------------------------------------------------------------------------------
from collections import deque
N0 = 2**(N).bit_length()
INF = float("inf")
INF = -(2**31-1) 

data = [INF]*(2*N0)

def update(k,x):
    k += N0 - 1
    data[k] = x
    while k >= 0:
        k = (k-1)//2
        data[k] = max(data[2*k+1], data[2*k+2])

# $B6h4V(B[l, r)$B$N:G>.CM(B
def query(l,r):
    L = l + N0 - 1 # $B$J$s$G(BN0$B$rB-$7$F$$$k!D(B?
    R = r + N0 - 1
    # print("L: {}, R: {}".format(L,R))
    s = INF
    while L < R:
        # print("\tL: {}, R: {}".format(L,R))

        if R & 1 == 0:
            s = max(s, data[R])
            R -= 2
            # R -= 1
            # s = max(s,data[R-1])
        else:
            s = max(s, data[R])
            R -= 3

        if L & 1:
            # s = max(s, data[L-1])
            s = max(s, data[L])
            # L += 1
            L -= 1
        else:
            s = max(s,data[L])
            
        L >>= 1; R >>= 1
    if L == R:
        s = max(s,data[L])
    return s
# def query(l,r):
#     L = l + N0 # $B$J$s$G(BN0$B$rB-$7$F$$$k!D(B?
#     R = r + N0
#     print("L: {}, R: {}".format(L,R))
#     s = INF
#     while L < R:
#         print("\tL: {}, R: {}".format(L,R))
# 
#         if R & 1:
#             R -= 1
#             s = max(s,data[R-1])
#         if L & 1:
#             s = max(s, data[L-1])
#             L += 1
#         L >>= 1; R >>= 1
#     return s
# ---------------------------------------------------------------------------------
dp = [0] * (N+1)
#dp = [ [0] * (N+1) for _ in range(2*10**5+1)]

for i in range(1,N+1):
    # print("query: 0 to H[i-1]=",H[i-1])
    dp[i] = max(query(0, H[i-1]), 0) + A[i-1]
    update(H[i-1], dp[i])
print(max(dp))



Measured memory_bytes: 123684
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)
import heapq

# def floor(value):
#     if int(value) == value:
#         return value//2
#     else:
#         return (value + 1) // 2


def main():
    N, M = map(int, input().split())
    A = [int(c) for c in input().split()]
    queue = []


    for i in range(N):
        heapq.heappush(queue, - A[i])
    # print(queue)
    for i in range(M):
        max_ = heapq.heappop(queue)
        heapq.heappush(queue, (max_+1)//2)
        # print(queue)
    
    print(- sum(queue))




if __name__ == '__main__':
    main()

Measured memory_bytes: 23104
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[N], B[N];

    rep(i, N) cin >> A[i] >> B[i];
    int max = 0;
    int index = 0;
    rep(i, N) {
        if (A[i] > max) {
            max = A[i];
            index = i;
        }
    }
    cout << max + B[index] << endl;

    return 0;
}


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


n, t = map(int, input().split())

DISHES = [(0, 0)]
for _ in range(n):
    a, b = map(int, input().split())
    DISHES.append((a, b))
DISHES.sort()

DP = [[0] * (t + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
    a, b = DISHES[i]
    for j in range(1, t + 1):
        if j - a < 0:
            DP[i][j] = DP[i - 1][j]
        else:
            DP[i][j] = max(DP[i - 1][j], DP[i - 1][j - a] + b)

answer = 0
for k in range(1, n + 1):
    answer = max(answer, DP[k - 1][t - 1] + DISHES[k][1])

print(answer)


Measured memory_bytes: 112988
n = int(input())

L = [0 for i in range(4)]

#print(L)

for i in range(n):
    a = input()
    
    if a == 'AC':
        L[0] += 1
    if a == 'WA':
        L[1] += 1
    if a == 'TLE':
        L[2] += 1
    if a == 'RE':
        L[3] += 1

print('AC x ' + str(L[0]))
print('WA x ' + str(L[1]))
print('TLE x ' + str(L[2]))
print('RE x ' + str(L[3]))


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

int main() {
  
  int64_t N, A, B; cin >> N >> A >> B;
  
  int64_t loseAll = N - A; int64_t winAll = B - 1;
  
  int64_t minAll = min(loseAll, winAll);
  
  int64_t backFrom1 = A + (B - A - 1) / 2;
  
  int64_t backFromN = N - B + 1 + (B - A - 1) / 2;
  
  int64_t minBack = min(backFrom1, backFromN);
  
  if ((B - A) % 2 == 0) {
    
    int64_t center = (B - A) / 2;
    
    cout << center << endl;
    
  }
  
  else cout << min(minAll, minBack) << endl;
  
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());


            Console.WriteLine(n*(n-1)/2);

        }
    }
}

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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;

int a, b, c;

void init ();
void input ();
void work ();



int main ()
{
	init ();
	input ();
	work ();
}



void init ()
{
	// Init Everything Here

	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method

	cin >> a >> b >> c;
}

void work ()
{
	// main work

	cout << ( qmin ( a + b + 1, c ) + b ) << endl;
}

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

int main() {
    
    int a, b;
    cin>>a>>b;
    
    if(a > b) {
        cout<<"a > b"<<endl;
    } else if(a < b) {
        cout<<"a < b"<<endl;
    } else {
        cout<<"a == b"<<endl;
    }
    
    return 0;
}


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

int main() {
  int n, y;
  cin >> n >> y;
  
  for(int i = 0; i <= n; ++i) {
    for(int j = 0; i+j <= n; ++j) {
      int k = n-i-j;
      if(i*10000 + j*5000 + k*1000 == y) {
        cout << i << " " << j << " " << k << endl;
        return 0;
      }
    }
  }
  
  cout << "-1 -1 -1" << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main(void)
{
    int H, W;
    int a[50][50];
    int b[50][50];
    int h, w;
    int c[50][50];
    int sum, max;
    int flag;
    int ax, ay, bx, by, cx, cy;
    
    scanf("%d%d", &H, &W);
    for (ay = 0; ay < H; ay++){
        for (ax = 0; ax < W; ax++){
            scanf("%d", &a[ay][ax]);
        }
    }
    for (by = 0; by < H; by++){
        for (bx = 0; bx < W; bx++){
            scanf("%d", &b[by][bx]);
        }
    }
    scanf("%d%d", &h, &w);
    for (cy = 0; cy < h; cy++){
        for (cx = 0; cx < w; cx++){
            scanf("%d", &c[cy][cx]);
        }
    }

    flag = 0;
    max = -100 * 50 * 50;
    for (by = 0; by < H - h + 1; by++){
        for (bx = 0; bx < W - w + 1; bx++){
            for (cy = 0; cy < h; cy++){
                for (cx = 0; cx < w; cx++){
                    if (b[by + cy][bx + cx] != c[cy][cx]){
                        goto UNMATCH;
                    }
                }
            }
            sum = 0;
            for (cy = 0; cy < h; cy++){
                for (cx = 0; cx < w; cx++){
                    sum += a[by + cy][bx + cx];
                }
            }
            if (max < sum){
                max = sum;
                flag = 1;
            }
UNMATCH:;
        }
    }
    
    if (flag == 0){
        printf("NA\n");
    }
    else {
        printf("%d\n", max);
    }
    return (0);
}




Measured memory_bytes: 2112
#include<stdio.h>

int gcd(long long int a,long long int b)
{
    return a ? gcd(b % a,a) : b;
}
int main()
{
    long long int n,a[100000];
    scanf("%lld",&n);
    long long int k;
    for(int i = 1 ; i <= n ; i ++ )
    {
        scanf("%lld",&a[i]);
    }
    k = a[1];
    for(int i = 2 ; i <= n ; i ++ )
    {
        k = gcd(k,a[i]);
    }
    printf("%lld\n",k);
    return 0;
}

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

int main() {

ll N;
ll ans = 0;

cin >> N;

for (int i=1; i< N+1; i++){
    if (i % 3 == 0 && i % 5 == 0) {
        //cout << "FizzBuzz" << endl;
    }
    else if (i % 3 == 0 && i % 5 != 0){
        //cout << "Fizz" << endl;
    }
    else if (i % 5 == 0 && i % 3 != 0) {
        //cout << "Buzz" << endl;
    }
    else{        
        ans+=i;
    }
}

cout << ans << endl;




}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int c=110,f=-1;
  for(int i=s.length()-1;i>=0;i--)if(s[i]=='C')c=i;
  for(int i=0;i<s.length();i++)if(s[i]=='F')f=i;
  if(c<f)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3600
lis=[]
n=int(input())
for i in range(n):
 lis.append(str(input()))


print("AC x "+str(lis.count("AC")))
print("WA x "+str(lis.count("WA")))
print("TLE x "+str(lis.count("TLE")))
print("RE x "+str(lis.count("RE")))


Measured memory_bytes: 16252
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

const int MOD = 924844033;

int main()
{
    int n, k;
    cin >> n >> k;

    vector<int> cnt(n+1, 0);
    cnt[0] = 1;
    for(int i=0; i<2*k; ++i){
        vector<vector<int> > dp(2, vector<int>(n+1, 0));
        if(i < k)
            dp[0] = cnt;
        else
            dp[1] = cnt;

        for(int j=i; j<n; j+=2*k){
            vector<vector<int> > nextDp(2, vector<int>(n+1, 0));
            for(int a=0; a<2; ++a){
                for(int b=0; b<n; ++b){
                    if(a == 1){
                        nextDp[1][b+1] += dp[a][b];
                        nextDp[1][b+1] %= MOD;
                    }
                    if(j + k < n){
                        nextDp[0][b+1] += dp[a][b];
                        nextDp[0][b+1] %= MOD;
                    }
                    nextDp[1][b] += dp[a][b];
                    nextDp[1][b] %= MOD;
                }
            }
            dp.swap(nextDp);
        }

        for(int b=0; b<=n; ++b)
            cnt[b] = (dp[0][b] + dp[1][b]) % MOD;
    }

    long long tmp = 1;
    long long ans = 0;
    for(int i=0; i<=n; ++i){
        if((n - i) % 2 == 0)
            ans += tmp * cnt[n-i];
        else
            ans -= tmp * cnt[n-i];
        ans %= MOD;
        ans += MOD;
        ans %= MOD;
        tmp *= i + 1;
        tmp %= MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {

    static long MOD = 1000000007;

    public static long gcd(long a, long b) {
        if(b == 0) return a;
        return gcd(b, a%b);
    }

    public static long lcm(long a, long b) {
        return a * b / gcd(a,b);
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Node> l = new ArrayList<>();
        for(int i = 0; i < n; i++) {
            l.add(new Node(sc.nextInt(), sc.nextInt()));
        }
        l.sort(Comparator.comparingInt(Node::b));
        int now = 0;
        boolean ok = true;
        for(int i = 0; i < n; i++) {
            Node no = l.get(i);
            if(no.a + now > no.b) {
                ok = false;
                break;
            }
            now = no.a + now;
        }
        System.out.println(ok?"Yes":"No");

    }
    static class Node {
        int a;
        int b;
        Node(int c, int d) {
            a = c;
            b = d;
        }
        public int b() {
            return this.b;
        }
    }
}

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int N, Z, W;
	cin >>N >>Z >>W;
	vector<int> A(N+1, 0);
	A.at(0)=W;
	for (int i=1; i<=N; i++)
		cin >>A.at(i);
	vector<int> X(N+1, -1);
	vector<int> Y(N+1, 1000000001);
	X.at(N)=abs(A.at(N-1)-A.at(N));
	Y.at(N)=abs(A.at(N-1)-A.at(N));
	for (int i=N-1; i>0; i--) {
		X.at(i)=abs(A.at(i-1)-A.at(N));
		Y.at(i)=abs(A.at(i-1)-A.at(N));
		for (int j=i+1; j<=N; j++) {
			X.at(i)=max(X.at(i), Y.at(j));
			Y.at(i)=min(Y.at(i), X.at(j));
		}
	}
	cout <<X.at(1) <<endl;
	return 0;
}



Measured memory_bytes: 256
import math
 
a, b, x = map(int, input().split())

if x >= (a**2)*b/2:
  t = 2*(b*a*a - x)/a/a/a
  theta = math.atan(t) * 180 / math.pi
else:
  t = a*(b**2)/x/2
  theta = math.atan(t) * 180 / math.pi


print(theta)

Measured memory_bytes: 3060
#![allow(non_snake_case)]
#[allow(unused_imports)]
use std::io::{self, Write};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, char) => {
        read_value!($next, String).chars().collect::<Vec<char>>()[0]
     };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
     };
    ($next:expr, isize1) => {
        read_value!($next, isize) - 1
    };
     ($next:expr, $t:ty) => {
         $next().parse::<$t>().expect("Parse error")
    };
}
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}
#[allow(dead_code)]
const MOD: u64 = 1000000007;
#[allow(dead_code)]
fn to_num(c: char) -> i64 {
    c as i64 - 48
}


fn main() {
    input!{
        S: String
    }
    let patterns = vec!["maerd", "remaerd", "esare", "resare"];
    let rev: String = S.chars().rev().collect();

    let mut ans = true;
    let mut i = 0;
    while i < rev.len() {
        let mut flag = false;
        for &p in patterns.iter() {
            if i + p.len() <= rev.len() && p == &rev[i..i + p.len()] {
                i += p.len();
                flag = true;
                break;
            }
        }
        if !flag {
            ans = false;
            break;
        }
    }


    println!("{}", if ans { "YES" } else { "NO" });
}

Measured memory_bytes: 4352
//ΔARC090B
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 111111;
int n,m,a[N],vis[N];
vector<int> v[N],p[N];
void dfs(int u){
	int i,x,z;
	vis[u]=1;
	i=v[u].size();
	while(i--){
		x=v[u][i];
		z=p[u][i];
		if(vis[x]){
			if(a[x]!=a[u]+z){
				printf("No");
				exit(0);
			}
		}
		else{
			a[x]=a[u]+z;
			dfs(x);
		}
	}
}
int main()
{
	int i,x,y,z;
	scanf("%d%d",&n,&m);
	while(m--){
		scanf("%d%d%d",&x,&y,&z);
		v[x].push_back(y);
		p[x].push_back(z);
		v[y].push_back(x);
		p[y].push_back(-z);
	}
	for(i=1;i<=n;i=i+1)
		if(!vis[i])
			dfs(i);
	printf("Yes");
	return 0;
}

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

using namespace std;

int main(){
  string s,x;
  int n;
  while(1){
    cin>>s;
    if(s[0]=='-')break;
    n=s.length();
    int m;
    cin>>m;
    if(m>100||m<1)break;
    for(int i=0;i<m;i++){
      x=s;
      int h;
      cin>>h;
      for(int v=0;v<n;v++){
        if(v<n-h)s[v]=x[v+h];
        if(v>=n-h)s[v]=x[v-(n-h)];
      }
    }
    cout<<s<<endl;
  }
}



Measured memory_bytes: 3164