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

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        String X = sc.next();
        
        if(X.charAt(0) == X.charAt(1) && X.charAt(1) == X.charAt(2)){
            System.out.println("Yes");
        }else if(X.charAt(1) == X.charAt(2) && X.charAt(2) == X.charAt(3)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 22996
public class Main {
    public static void main(String[] args) {
 
        java.util.Scanner sc = new java.util.Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double C = sc.nextDouble();

         double h = b * Math.sin(Math.toRadians(C));
        double S = 0.5 * h * a;
        double L = a + b + Math.sqrt(a * a + b * b - 2 * a * b * Math.cos(Math.toRadians(C)));
        System.out.println(String.format("%10.8f", S));
        System.out.println(String.format("%10.8f", L));
        System.out.println(String.format("%10.8f", h));
    }
}

Measured memory_bytes: 28048
import sys
import math
while True:
    x = sys.stdin.readline().strip()
    a = list(x.split())
    if a[1] == "?":
        break
    else:
        x = int(a[0])
        y = int(a[2])
        if a[1] == "+":
            print(x + y)
        elif a[1] == "-":
            print(x - y)
        elif a[1] == "*":
            print(x * y)
        elif a[1] == "/":
            print(math.floor(x / y))

Measured memory_bytes: 7768
import java.util.*;
public class Main{
    static long[][] dp = new long[110][100100];
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long[][] a = new long[1000000][3];
        int n = sc.nextInt();
        int w = sc.nextInt();
        int weight[] = new int[110];
        int value[] = new int[110];
        for(int i=0; i<n; i++){
            weight[i] = sc.nextInt();
            value[i] = sc.nextInt();
        }

        for(int i=0; i<n; i++){
            for(int sum_w=0; sum_w<=w; sum_w++){

                //i番目の品をナップサックに入れる場合
                if(sum_w - weight[i]>=0){
                    dp[i+1][sum_w] = Math.max(dp[i+1][sum_w], dp[i][sum_w - weight[i]]+value[i]);
                }
                //i番目の品を入れない場合
                dp[i+1][sum_w] = Math.max(dp[i+1][sum_w], dp[i][sum_w]);
            }
        }
        System.out.println(dp[n][w]);
    }
}


Measured memory_bytes: 170964
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,d,x,y,ans=0;
    cin>>n>>d;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        if(sqrt(x*x+y*y)<=d){
            ans++;
        }
    }
    cout<<ans<<endl;
    return(0);
}

Measured memory_bytes: 3660
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.immutable.Queue

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def solve(sc: => Scanner): Unit = {
    val N, M = sc.nextInt
    val A = Array.fill(N)(sc.nextInt).reverse
    var B = Set[Int]()
    var count = 0
    var idx = 0
    while (count < M && idx < A.size) {
      if (!B(A(idx))) {
        B = B + A(idx)
        count += 1
        println(A(idx))
      }
      idx += 1
    }
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

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

typedef long long LL;  
using namespace std;

#define fillchar(a, x) memset(a, x, sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'

const int M = (int)1e9+7;

int main()
{
//ios_base::sync_with_stdio(0); 
	cout.precision(15);
	cout.setf(ios::fixed);

	int n,c,k;

	cin >> n >> c >> k;

	vector <int> v(n);

	for(int i=0;i<n;i++)
		{
			cin >> v[i];
		}

	sort(v.begin(),v.end());
	
	int bus = 0;	
	int tm = -1;
	int cp = 0;

	for(int i=0;i<n;i++)	
		{
			if(tm<v[i] || cp==c)
				{
					bus++;
					tm = v[i] + k;
					cp = 0;
				}

			cp++;	
		}

	cout<<bus<<endl;	

}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int dl[300000]={};//左から
int dr[300000]={};//右から
int n;

bool cdl(int s){
	bool ans=0;
	if(s==n-1) return true;
	for(int i=1; i<=dl[s]/10; i++){
		if(cdl(s+i)){
			ans=true;
			break;
		}
	}
	dl[s]=0;
	return ans;
}

bool cdr(int s){
	bool ans=0;
	if(s==n-1) return true;
	for(int i=1; i<=dr[s]/10; i++){
		if(cdr(s+i)){
			ans=true;
			break;
		}
	}
	dr[s]=0;
	return ans;
}

int main(){
	cin>>n;
	for(int i=0; i<n; i++){
		int a; cin>>a;
		dl[i]=a;
		dr[n-1-i]=a;
	}
	if(cdr(0) && cdl(0)) cout<<"yes"<<endl;
	else cout<<"no"<<endl;
}


Measured memory_bytes: 19476
import java.util.*;
import static java.lang.Math.*;

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

		// 入力
		int n = sc.nextInt();
		int[] h = new int[n];
		
		String result = "Yes";
		
		for(int i = 0; i < n; i++){
		    h[i] = sc.nextInt();
		    if(i > 0 && h[i - 1] < h[i]){
                h[i]--;		        
		    }else if(i > 0 && h[i - 1] > h[i]){
		        result = "No";
		    }
		}
		
		// 計算

		// 出力
        System.out.println(result);
		
	}
}


Measured memory_bytes: 50812
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var A = consoleReader.Int;
            var B = consoleReader.Int;
            var AB = A + B;
            if ((A % 3) == 0 || (B % 3) == 0 || (AB % 3) == 0) return "Possible";
            return "Impossible";
        }

        #region いつもの
#pragma warning disable
        private ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
    }
    static class Ext
    {
        public static Dictionary<TKey, int> GroupCount<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) => source.GroupBy(keySelector).ToDictionary(g => g.Key, g => g.Count());
        public static Dictionary<TKey, int> GroupCount<TKey>(this IEnumerable<TKey> source) => source.GroupCount(i => i);
    }
    public class ConsoleReader { private string[] ReadLineSplit() => textReader.ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries); private string[] line = Array.Empty<string>(); private int linePosition; private TextReader textReader; public ConsoleReader(TextReader tr) { textReader = tr; } public int Int => int.Parse(String); public long Long => long.Parse(String); public double Double => double.Parse(String); public string String { get { if (linePosition >= line.Length) { linePosition = 0; line = ReadLineSplit(); } return line[linePosition++]; } } public class SplitLine { private string[] splited; public SplitLine(ConsoleReader cr) { splited = cr.ReadLineSplit(); cr.line = Array.Empty<string>(); } public int[] Int => String.Select(x => int.Parse(x)).ToArray(); public int[] Int0 => String.Select(x => int.Parse(x) - 1).ToArray(); public long[] Long => String.Select(x => long.Parse(x)).ToArray(); public double[] Double => String.Select(x => double.Parse(x)).ToArray(); public string[] String => splited; } public SplitLine Split => new SplitLine(this); public class RepeatReader : IEnumerable<ConsoleReader> { ConsoleReader cr; int count; public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; } public IEnumerator<ConsoleReader> GetEnumerator() => Enumerable.Repeat(cr, count).GetEnumerator(); System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public IEnumerable<string> String => this.Select(cr => cr.String); public IEnumerable<int> Int => this.Select(cr => cr.Int); public IEnumerable<int> Int0 => this.Select(cr => cr.Int - 1); public IEnumerable<long> Long => this.Select(cr => cr.Long); public IEnumerable<double> Double => this.Select(cr => cr.Double); } public RepeatReader Repeat(int count) => new RepeatReader(this, count); }
    #endregion
}


Measured memory_bytes: 11092
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] H = new int[N];

        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }

        int A, B;
        Set<Integer> Dtowers = new HashSet<>();

        for (int i = 0; i < M; i++) {
            A = sc.nextInt();
            B = sc.nextInt();
            if (H[A - 1] == H[B - 1]) {
                Dtowers.add(A);
                Dtowers.add(B);
            } else if (H[A - 1] > H[B - 1]) {
                Dtowers.add(B);
            } else {
                Dtowers.add(A);
            }

        }

        System.out.println(N - Dtowers.size());

        sc.close();
    }
}

Measured memory_bytes: 61744
n = int(input())
a,b=map(int,input().split())

if a == b:
    if a % n == 0:
        print('OK')
    else:
        print('NG')
elif a % n == 0:
    print('OK')
else:
    while a < b:
        a += 1
        if a % n == 0:
            print('OK')
            break
        elif a == b:
            print("NG")

Measured memory_bytes: 9180
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  int n = (int) s.size();
  map<int, int> mp;
  mp[0] = 0;
  int cur = 0;
  vector<int> candi = {0};
  for (int i = 0; i < 26; i++) candi.push_back(1 << i);
  for (int i = 0; i < n; i++) {
    cur ^= (1 << (s[i] - 'a'));
    int res = 1 << 30;
    if (!mp.count(cur)) mp[cur] = res;
    for (int x : candi) {
      int y = x ^ cur;
      if (mp.count(y)) mp[cur] = min(mp[cur], mp[y] + 1);
    }
  }
  cout << (mp[cur] == 0 ? 1 : mp[cur]) << endl;
}

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

int main() {
	int N;
	cin >> N;
	int ans = 0;
	for(int i = 1; i <= N; i += 2){
		int counter = 0;
		for(int j = 1; j <= i; j++){
			if(i % j == 0){
				counter++;
			}
		}
		if(counter == 8){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/**Author:Sagor*/

#include<bits/stdc++.h>
#include<numeric>

using namespace std;
#define pri(n)          printf("%d\n",n)
#define prll(n)         printf("%lld\n",n)
#define prd(n)          printf("%lf\n",n)
#define scll(n)         scanf("%lld",&n)
#define sci(n)          scanf("%d",&n)
#define scd(n)          scanf("%lf",&n)
#define pi              acos(-1)//inbuilt M_PI
#define ll              long long
#define pb              push_back
#define vsort(v)        sort(v.begin(),v.end())
#define asort(n)        sort(ar,ar+n)
#define yes             cout<<"Yes\n"
#define no              cout<<"No\n"
#define for1(i,n)       for(i=1;i<=n;i++)
#define for0(i,n)       for(i=0;i<n;i++)
#define mod             1000000007
#define watch(x)        cout << (#x) << " is " << (x) <<"\n";

/** for print with quote \"hello world\"
    1LL is used to convert into long long*/


int main()
{
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    /**ios_base::sync_with_stdio(false);
    cin.tie(NULL);/**Dont't use scanf of printf*/
    ll n,sum=0,i,a;
    cin>>n;
    for0(i,n){
        cin>>a;
        sum+=(a-1);
    }
    cout<<sum<<endl;


    return 0;
}


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

int a[333]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
    int n; cin >> n;
    cout << a[n] << endl;
    return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
L=[0]*M
for n in range(N):
  k=list(map(int,input().split()))
  k.remove(k[0])
  for a in k:
    L[a-1]+=1
    
ans=0    
for n in range(M):
  if L[n]==N:
    ans+=1
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace  std;
typedef long long int ll;
#define INF 1000000007
ll dp[100001];
ll  h[100001];
ll n,k;
ll fun(ll i)
{
	ll m1=INF;
	if(i>=n)
	return 0;
	if(dp[i]!=-1)
	return dp[i];
	ll j;
	for(j=1;j<=k;j++)
	{
		if(i+j<=n)
		m1=min(m1,abs(h[i]-h[i+j])+fun(i+j));
	}
	return dp[i]=m1;
}
int main()
{
	ll i;
	cin>>n>>k;
	memset(dp,-1,sizeof(dp));
	for(i=1;i<=n;i++)
	cin>>h[i];
	cout<<fun(1)<<endl;
	
}

Measured memory_bytes: 6528
const dishes = require('fs').readFileSync('/dev/stdin', 'utf8').split(/\n/).map(i=>parseInt(i,10)).slice(0,5);

mins = dishes.map(i => i % 10).filter(i => i !== 0);
const minRest = mins.length ? Math.min(...mins) : 10;

console.log(dishes.map(i => Math.ceil(i / 10) * 10).reduce((a,c)=>a+c) - 10 + minRest);

Measured memory_bytes: 7372
(N,M,X),*A=$<.map{|e|e.split.map &:to_i}
p (1..N).map{|n|A.combination(n).select{|e|e.transpose.drop(1).all?{|e|X<=e.inject(:+)}}.map{|e|e.inject(0){|s,x|s+x[0]}}}.flatten.min||-1

Measured memory_bytes: 14664
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<ll,pair<ll,ll>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main(){
    int d, t, s;
	cin >> d >> t >> s;
	if(d <= t * s)cout << "Yes" << endl;
	else cout << "No" << endl;
} 


Measured memory_bytes: 3636
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()

l = []
l.append(2)
l.append(1)

if n > 1:
    for i in range(2,n+1):
        l.append(l[-1]+l[-2])
        
print(l[n])

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)



class min_cost_flow
{
private:
    struct edge{
        long long to, cap, cost, rev;
    };
    long long vertex;   // 頂点数
    long long infinity; // 初期化に使う値
    vector<vector<edge>> graph;     // グラフの隣接リスト
    vector<long long> distance;     // 最短距離
    vector<long long> prev_v, prev_e;   // 直前の頂点と辺
public:
    min_cost_flow(long long v, long long inf = 1e16);     // vは頂点の数, infは初期化に使う値
    void add_edge(long long from, long long to, long long cap, long long cost);     // fromからtoへ向かう容量cap、コストcostの辺を張る
    long long get_min_cost_flow(long long s, long long t, long long f);     // sからtへの流量fの最小費用流を求める。流せない場合は-1を返す。
};

min_cost_flow::min_cost_flow(long long v, long long inf){
    vertex = v;
    infinity = inf;
    graph.resize(vertex);
    distance.resize(vertex);
    prev_v.resize(vertex);
    prev_e.resize(vertex);
}

void min_cost_flow::add_edge(long long from, long long to, long long cap, long long cost){
    graph[from].push_back((edge){to, cap, cost, (long long)graph[to].size()});
    graph[to].push_back((edge){from, 0, -cost, (long long)graph[from].size() - 1});
}

long long min_cost_flow::get_min_cost_flow(long long s, long long t, long long f){
    long long res = 0;
    
    while(f > 0){
        distance.assign(vertex, infinity);
        distance[s] = 0;
        bool update = true;
        while(update){
            update = false;
            for(long long v = 0; v < vertex; v++){
                if(distance[v] == infinity) continue;
                for(long long i = 0; i < graph[v].size(); i++){
                    edge &e = graph[v][i];
                    if(e.cap > 0 && distance[e.to] > distance[v] + e.cost){
                        distance[e.to] = distance[v] + e.cost;
                        prev_v[e.to] = v;
                        prev_e[e.to] = i;
                        update = true;
                    }
                }
            }
        }
    
        if(distance[t] == infinity) return -1;
        
        long long d = f;
        for(long long v = t; v != s; v = prev_v[v]){
            d = min(d, graph[prev_v[v]][prev_e[v]].cap);
        }
        f -= d;
        res += d * distance[t];
        for(long long v = t; v != s; v = prev_v[v]){
            edge &e = graph[prev_v[v]][prev_e[v]];
            e.cap -= d;
            graph[v][e.rev].cap += d;
        }
    }
    
    return res;
}

int main() {
    ll V, e, f;
    cin >> V >> e >> f;
    min_cost_flow m(V);
    REP(i, e){
        ll u, v, c, d;
        cin >> u >> v >> c >> d;
        m.add_edge(u, v, c, d);
    }
    cout << m.get_min_cost_flow(0, V - 1, f) << endl;
}



Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	long long res = 1ll<<60;
	for(int rot = 0; rot < 2; rot++){
		long long sum = 0, ans = 0;
		for(int i = 0; i < n; i++){
			sum += a[i];
			if(sum < 0){
				if((rot^i)&1) ans += abs(sum) + 1, sum = 1;
			} else if(sum > 0){
				if((rot^i)&1);
				else ans += abs(sum) + 1, sum = -1;
			} else {
				if((rot^i)&1) sum += 1, ans += 1;
				else sum -= 1, ans += 1;
			}
		}
		res = min(res, ans);
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 640
// D - String Equivalence
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	int N; cin>>N;
	vector<pair<char,string>> s(1,{'a',"a"});
	while(--N){
		vector<pair<char,string>>t; swap(s,t);
		rep(i, t.size()){
			char mx; string pre; tie(mx,pre) = t[i];
			for(char c='a'; c<=mx+1; ++c) s.push_back({max(mx, c), pre + c});
		}
	}
	rep(i, s.size()) cout<< s[i].second <<endl;
}

Measured memory_bytes: 10080
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#define ll long long
using namespace std;

int main() {
	ll n, a[1000], ans = 1;
	cin >> n;
	for (int i = 0; i < 1000; i++) {
		a[i] = 1;
	}

	for (int j = 2; j <= n; j++) {
		int k = j;
		for (int i = 2; i < 1000;) {
			if (k % i == 0) {
				k /= i;
				a[i]++;
			} else {
				i++;
			}
		}
	}
	for (int i = 0; i < 1000; i++) {
		ans *= a[i];
		ans = ans % 1000000007;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
def do(b_num,step,now_p,item,t):
    global ans,p,memo
    if (b_num,step,now_p,item,t) in memo:
        return
    memo.add((b_num,step,now_p,item,t))
    if item==0 and b_num>=n:
        ans=min(ans,step)
        return
    
    if b_num<n and t+(item+1)*abs(balloons[b_num][0]-now_p)<=balloons[b_num][1] and item<=2:
        do(b_num+1,step+abs(balloons[b_num][0]-now_p),balloons[b_num][0],item+1,balloons[b_num][1])
    else:
        p=max(p,b_num)
    if now_p!=0:
        do(b_num,step+now_p,0,0,t+(item+1)*now_p)
 
while True:
    ans=99999999
    p=-1
    n=int(input())
    if n==0:
        break
    balloons=[]
    memo=set()
    for i in range(n):
        balloons.append(tuple(map(int,input().split())))
    do(0,0,0,0,0)
    if ans!=99999999:
        print('OK',ans)
    else:
        print('NG',p+1)



Measured memory_bytes: 17308
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main(){
    input!{
        a: i32,
    }

    println!("{}", 3 * i32::pow(a, 2));

}

Measured memory_bytes: 4476
while True:
	try:
		[a, b, c, d, e, f] = map(float, raw_input().split())
		i = d/a
		j = i * b - e
		k = i * c - f
		y = float(k/j)
		x = float((c - b * y)/a)
		print "%.3f %.3f" % (x, y)
	except (EOFError):
		break;

Measured memory_bytes: 4228
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    a,p = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    print((a*3+p)//2)





if __name__ == "__main__":
    main()

Measured memory_bytes: 10204
#include<stdio.h>

int main(void)
{
char str[20],revstr[20];
int i=0;
scanf("%s",str);
while(i<strlen(str))
{
revstr[i]=str[strlen(str)-i-1];
i++;
}
revstr[strlen(str)]='\0';
printf("%s\n",revstr);
return 0;
}

Measured memory_bytes: 524
#include <stdio.h>

int main(void) {
	long long int n;
	scanf("%lld", &n);

	if (n%2 != 0) {
		puts("0");
		return 0;
	}

	long long int cnt = 0;
	long long int div = 2;
	while (n/(div *= 5)) {
		cnt += n/div;
	}

	printf("%lld\n", cnt);
}


Measured memory_bytes: 128
def Input(egara, rank):
    if(egara == 'S'):
        S[rank] = True
    if(egara == 'H'):
        H[rank] = True
    if(egara == 'C'):
        C[rank] = True
    if(egara == 'D'):
        D[rank] = True

def Output():
    for egara in ['S', 'H', 'C', 'D']:
        if(egara == 'S'):
            for rank in range(13):
                if S[rank] == False:
                    print('S ' + str(rank + 1))
        if(egara == 'H'):
            for rank in range(13):
                if H[rank] == False:
                    print('H ' + str(rank + 1))
        if(egara == 'C'):
            for rank in range(13):
                if C[rank] == False:
                    print('C ' + str(rank + 1))
        if(egara == 'D'):
            for rank in range(13):
                if D[rank] == False:
                    print('D ' + str(rank + 1))
n = int(input())

S = 13 * [False]
H = 13 * [False]
C = 13 * [False]
D = 13 * [False]

for idx in range(n):
    Card = input().split()
    EGARA = Card[0]
    RANK = int(Card[1]) - 1
    Input(EGARA, RANK)

Output()

Measured memory_bytes: 7768
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    cout << (n-k+1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define mem(a) memset(a,0,sizeof(a))
#define pd(a) printf("%.10f\n",a)
#define pb(a) push_back(a)
#define in(a) insert(a)
#define pi M_PI
#define R cin>>
#define F first
#define S second
#define C class
#define ll long long
#define ln cout<<'\n'
template<C T>void pr(T a){cout<<a;ln;}
template<C T,C T2>void pr(T a,T2 b){cout<<a<<' '<<b;ln;}
template<C T,C T2,C T3>void pr(T a,T2 b,T3 c){cout<<a<<' '<<b<<' '<<c;ln;}
template<C T>void PR(T a,int n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  bool u[4];
  mem(u);
  rep(i,s.size()) {
    if(s[i]=='N') u[0]=1;
    if(s[i]=='S') u[1]=1;
    if(s[i]=='E') u[2]=1;
    if(s[i]=='W') u[3]=1;
  }
  bool f=1;
  if(u[0]&&!u[1]) f=0;
  if(!u[0]&&u[1]) f=0;
  if(u[2]&&!u[3]) f=0;
  if(!u[2]&&u[3]) f=0;
  if(f) pr("Yes");
  else pr("No");
}

int main() {
  ios::sync_with_stdio(0);cin.tie(0);
  Main();return 0;
}


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

int main(){
    /*
    vector<vector<int>> v;
    */
    int n;
    int xMin=0, yMin=0;
    int xMax, yMax;
    int ans;
    cin >> xMax >> yMax >> n;
    int a[n][3];
    /*
    vector< vector<int> >:: iterator r;
    vector<int>::iterator c;
    */
    for(int i=0; i<n; i++){
       for(int j=0; j<3; j++){
           cin >> a[i][j];
       }
       
       if(a[i][2]==1){
           xMin=max(a[i][0],xMin);
       }else if(a[i][2]==2){
           xMax=min(a[i][0],xMax);
       }else if(a[i][2]==3){
           yMin=max(a[i][1],yMin);
       }else if(a[i][2]==4){
           yMax=min(a[i][1],yMax);
       }
       
    }
    if((xMax-xMin<=0)||(yMax-yMin<=0)){
        cout<< 0 << endl;
    }else{
        cout << (xMax-xMin)*(yMax-yMin) << endl;
    }
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.*;
class Main
{
    public static void main(String[] args)throws IOException
    {
        FastReader in=new FastReader(System.in);
        StringBuffer st=new StringBuffer();
       int n=in.nextInt();
       int t=in.nextInt();
       int ans=1000000,d=t;
       while(n--!=0){
         int a=in.nextInt();
         int b=in.nextInt();
         if(b<=t){
          if(a<ans){
            ans=a;
          }
         }
       }
          if(ans==1000000)
        System.out.println("TLE");
        else
        System.out.println(ans);
    }
    static class FastReader{
 
        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;
 
        FastReader(InputStream is) {
            in = is;
        }
 
        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }
 
        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }
 
        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
 
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}      

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() {
    char c;
    cin >> c;
    if( c >= 'a' ){
     cout << "a" << endl;
    }else{
        cout << "A" << endl;
    }
  // Failed to predict input format
  return 0;
}


Measured memory_bytes: 3632
import sys
import math

S = raw_input()
if S[len(S)-1] == "\r":
    S = S[:len(S)-1]
S = S*2

T = raw_input()
if T[len(T)-1] == "\r":
    T = T[:len(T)-1]

if T in S:
    print "Yes"
else:
    print "No"

Measured memory_bytes: 6468
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <stdio.h>
#include <queue>

using namespace std;

long long N;
int main() {
	cin >> N;
	int a[100000];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	int x = 0;
	for (int i = 0; i < N; i++) {
		x = a[x]-1;
		if (x == 1) {
			cout << i + 1;
			return 0;
		}
	}
	cout << "-1";
	return 0;
}


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

typedef long long ll;

ll solve(ll a, ll b){
	if (!a || !b) return -a - b;
	if (a > b)
		return a / b * b * 2 + solve(a % b, b);
	else if (a < b)
		return b / a * a * 2 + solve(a, b % a);
	else
		return a;
}

int main(){
	ll N, X;
	scanf("%lld %lld", &N, &X);
	printf("%lld", N + solve(N - X, X));
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;

int main()
{
    fast;
    
	string s;
	cin>>s;
	ll cnt1=0,cnt2=0;
	for(ll i=0,j=s.size()-1;i<s.size()-1;i++,j--)
	{
		
		if(s[i]!=s[i+1])cnt1++;
		
		if(s[j]!=s[j-1])cnt2++;
	}
   
   
   cout<<min(cnt1,cnt2);
}

		
	
	
	
	


Measured memory_bytes: 3740
import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;

import java.io.*;

public class Main {
	
	void solve() {
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		int[] P = new int[26];
		for (int i = 0; i < N; i++) {
			P[sc.next().charAt(0)-'A']++;
		}
		
		int ans = 0;
		for (;;) {
			sort(P);
			boolean ok = true;
			for (int i = 0; i < K; i++) {
				if (P[26 - 1 - i] >= 1) {
					P[26 - 1 - i]--;
				} else {
					ok=false;
				}
			}
			if (ok) ans++; else break;
		}
		out.println(ans);
		
	}
	
	static void tr(Object... os) { System.err.println(deepToString(os)); }
	static void tr(int[][] as) { for (int[] a : as) tr(a); }

	void print(int[] a) {
		if (a.length > 0) out.print(a[0]);
		for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
		out.println();
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

Measured memory_bytes: 12788
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int ans;
vector<string>a(8);
set<vector<string> >s;
void ch(){
  if(s.count(a))return;
  r(i,2){
    swap(a[0],a[6]);
    swap(a[1],a[5]);
    swap(a[2],a[4]);
    swap(a[3],a[7]);
    r(j,4){
      swap(a[0],a[1]);
      swap(a[1],a[2]);
      swap(a[2],a[3]);
      swap(a[4],a[5]);
      swap(a[5],a[6]);
      swap(a[6],a[7]);
      r(k,3){
        swap(a[0],a[7]);
        swap(a[2],a[7]);
        swap(a[4],a[6]);
        swap(a[6],a[1]);
        s.insert(a);
      }
    }
  }
  ans++;
}
main(){
  while(cin>>a[0]){
    ans=0;int p=0;
    s.clear();
    r(i,7)cin>>a[i+1];
    sort(a.begin(),a.end());
    do{
      ch();
    }while(next_permutation(a.begin(),a.end()));
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 8788
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.ArrayDeque;

class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        int K = sc.nextInt();
        String S = sc.next();
        int l = S.length();
        
        if(l<=K){
            System.out.println(S);
        }
        else{
            S = S.substring(0, K);
            System.out.println(S + "...");
        }
    }
}

Measured memory_bytes: 38588
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define y1 shinkle
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<20|1;
inline char gc(){
    static char ibuf[RLEN],*ib,*ob;
    (ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob)?EOF:*ib++;
}
#define gc getchar
inline int read(){
    char ch=gc();
    int res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
    return f?res:-res;
}
inline ll readll(){
    char ch=gc();
    ll res=0;bool f=1;
    while(!isdigit(ch))f^=ch=='-',ch=gc();
    while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
    return f?res:-res;
}
inline int readstring(char *s){
	int top=0;char ch=gc();
	while(isspace(ch))ch=gc();
	while(!isspace(ch)&&ch!=EOF)s[++top]=ch,ch=gc();
	s[top+1]='\0';return top;
}
template<typename tp>inline void chemx(tp &a,tp b){a=max(a,b);}
template<typename tp>inline void chemn(tp &a,tp b){a=min(a,b);}
cs int N=200005;
int n,to[N],vis[N],stk[N],top;
ll k;
int main(){
	n=read();k=readll();
	for(int i=1;i<=n;i++)to[i]=read();
	int p=1;memset(vis,0,sizeof(vis));vis[1]=1;stk[top=1]=p;
	while(1){
		if(k==0){cout<<p<<'\n';return 0;}
		if(vis[to[p]]){
			int l=vis[to[p]],r=vis[p],del=vis[p]-vis[to[p]]+1;
			k--;
			//cout<<l<<" "<<r<<" "<<k<<" "<<del<<'\n';
			k%=del;cout<<stk[l+k]<<'\n';return 0;
		}
		p=to[p],stk[++top]=p;k--,vis[p]=top;
	}
}

Measured memory_bytes: 5736
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
void solve(){
    int N, K;
    cin >> N >> K;
    vector<int> V(N);
    for(int i = 0; i < N; ++i){
        cin >> V[i];
    }
    int max = INT_MIN;
    int R; (N < K)? R = N : R = K;      //
    for(int A = 0; A <= R; ++A){
        for(int B = 0; B <= R-A; ++B){
            vector<int> W;
            for(int a = 0; a < A; ++a){
                W.push_back(V[a]);
            }
            for(int b = 0; b < B; ++b){
                W.push_back(V[N-1-b]);
            }
            sort(W.begin(), W.end());
            int C; (A+B < K-(A+B))? C = A+B : C = K-(A+B);
            int i;
            for(i = 0; i < C && W[i] <= 0; ++i);
            int sum = 0;
            for(; i < A+B; ++i){
                sum += W[i];
            }
            if(max < sum) max = sum;
        }
    }
    cout << max;
}
int main(){
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

#define int long

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int n, h, w;

signed main(){
	scanf("%ld %ld %ld", &n, &h, &w);
	printf("%ld\n", (n-w+1) * (n-h+1));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <math.h>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i = 0; i < n ; i++)
#define pb push_back
static const int INF = 1000000;
static const int MAX = 200000;

typedef pair<int, int> P;
typedef pair<P, int> PP;

vector<int> G[MAX];
vector<int> G_rail[MAX];

//1はじまりあ
bool grouped[MAX];
bool grouped_rail[MAX];

int groupingNum[MAX];


class DisJointSet {
public:
  vector<int> rank,p;

  DisJointSet(){}
  DisJointSet(int size){
    rank.resize(size,0);
    p.resize(size,0);
    for(int i = 0; i < size; i++) makeSet(i);
  }

  void makeSet(int x){
    p[x] = x;
    rank[x] = 0;
  }

  bool same(int x, int y){
    return findSet(x) == findSet(y);
  }

  void unite(int x, int y){
    link(findSet(x), findSet(y));
  }

  void link(int x, int y){
    if( rank[x] > rank[y] ){
      p[y] = x;
    }else {
        p[x] = y;
        if( rank[x] == rank[y]){
          rank[y] ++;
        }
    }
  }

  int findSet(int x){
    if ( x != p[x] ){
      p[x] = findSet(p[x]);
    }
    return p[x];
  }
};

int main(void){
  int N,K,L; cin >> N >> K >> L;
  DisJointSet road(N+1);
  DisJointSet rail(N+1);
  int a,b;
  rep(i,K){
    cin >> a >> b;
    road.unite(a,b);
  }
  rep(i,L){
    cin >> a >> b;
    rail.unite(a,b);
  }

  map<P,int> mp;
  int c,d;
  rep(i,N){
    c = road.findSet(i+1);
    d = rail.findSet(i+1);
    mp[P(c,d)] += 1;
  }
  rep(i,N){
    c = road.findSet(i+1);
    d = rail.findSet(i+1);
    cout << mp[P(c,d)] << " ";
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 24448
n=int(input())
count = 0
last = 0
for a in range(n):
    z = list(input().split())
    if int(z[0]) == int(z[1]):
        count+=1
        if count >= 3:
            last = 1
    if int(z[0]) != int(z[1]):
        if count > 0:
            count = 0
        else:
            continue
if last == 1:
    print("Yes")
if last == 0:
    print("No")

Measured memory_bytes: 9184
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  unsigned int N;
  std::cin >> N;

  std::vector<unsigned int> p_array(N);
  for (unsigned int i = 0; i < N; ++i) {
    std::cin >> p_array.at(i);
  }

  std::vector<unsigned int> p_array_sorted = p_array;
  std::sort(p_array_sorted.begin(), p_array_sorted.end(), std::less<unsigned int>());

  unsigned int diff_num = 0;
  for (unsigned int i = 0; i < N; ++i) {
    if (p_array.at(i) != p_array_sorted.at(i)) {
      diff_num += 1;
    }
  }

  if (diff_num == 0 || diff_num == 2) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>

using namespace std;

int main() {
    
    int n;
    cin >> n;
    
    double sum = 0;
    for (int i = 0; i < n; ++i)
    {
        double x;
        string u;
        cin >> x >> u;
        
        if (u == "JPY")
        {
            sum += (double)x;
        }
        else
        {
            sum += (x * 380000.0);
        }
    }
    
    cout << sum << endl;
    
    return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
ll INF = LLONG_MAX;
 
using vc = vector<char>;
using vi = vector<int>;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N; cin >> N;
    vector<vi> graph (N);
    F0R(i, N-1) {
        int a; int b; cin >> a >> b;
        --a; --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    int bc = 0;
    int wc = 0;
    vector<bool> visited (N);
    queue<pair<int, bool>> q;
    q.push({0, 1});
    q.push({N-1, 0});
    visited[0] = true;
    visited[N-1] = true;
    while (!q.empty()) {
        int node = q.front().first;
        bool col = q.front().second;
        q.pop();

        if (col) ++bc;
        else ++wc;

        visited[node] = true;

        for (int n : graph[node]) {
            if (!visited[n]) q.push({n, col}), visited[n] = true;
        }
    }
    cout << ((bc > wc)  ? "Fennec" : "Snuke") << endl;
}

Measured memory_bytes: 5888
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int INF = 1001001001;

int main() {
  int N, M;
  cin >> N;
  vector<int> T(N);
  rep(i, 0, N) cin >> T[i];

  cin >> M;
  rep(i, 0, M) {
    int p, x;
    cin >> p >> x;
    p--;

    int ans = 0;
    rep(i, 0, N) {
      if (i == p)
        ans += x;
      else
        ans += T[i];
    }
    cout << ans << endl;
  }

  return 0;
}


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

//#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int res = -1;
    for (int i = 1; i <= 5; i++) {
        int x;
        cin >> x;
        if (x == 0) res = i;
    }
    cout << res << '\n';
}
/*

 */


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
#define int long long
signed main(void){
    int n,a,b; cin>>n>>a>>b;
    if(a == b) cout<<"Borys"<<endl;
    int d = b-a;
    if(d%2 == 0) cout<<"Alice"<<endl;
    else cout<<"Borys"<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#ifdef ConanYu
#include "local.hpp"
#else
#define debug(...) do { } while(0)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
}
#endif

void Main() {
  int n; cin >> n;
  cout << n * n * n << "\n";
}



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

namespace AtCoder
{
    class Abc160A
    {
        public static void Main()
        {
            var s = Console.ReadLine();

            if (s[2] == s[3] && s[4] == s[5])
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


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

using namespace std;

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

	int a, b, t, sum=0;
	
	cin >> a >> b >> t;
	
	for(int i=a; i<=(t+0.5); i=i+a){
		sum += b;
	}
	
	cout << sum << endl;
	
	return 0;
}


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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

int main() {
  int a, b;
  cin >> a >> b;

  if (b == 1) {
    ANS(0);
    return 0;
  }

  int sum = a;
  int ans = 1;
  while (sum < b) {
    sum += a - 1;
    ans++;
  }

  ANS(ans);
  return 0;
}


Measured memory_bytes: 256
N = int(input())

f = [0 for i in range(N)]

for x in range(1, int(N**0.5)+1) :
  for y in range(1, int(N**0.5)+1) :
    for z in range(1, int(N**0.5)+1) :
      n = x*x + y*y + z*z + x*y + y*z + z*x
      if n > N :
        break
      else :
        f[n-1] += 1
        
        
        
for i in range(N) :
  print(f[i])

Measured memory_bytes: 9504
n = int(input())
for _ in range(n):
    x, y, b, p = [int(x) for x in input().split()]
    
    f = x * b + y * p
    d = max(5,b)* x + max(2, p) * y
    d = int(d * 0.8)
    print(min(f,d))


Measured memory_bytes: 5624