akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<(b-a==c-b?"YES":"NO")<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define int LL
const LL inf=0x3f3f3f3f;
using namespace std;
template<typename tp> inline void read(tp &x)
{
	x=0; char c=getchar(); bool f=0;
	for(;c<'0'||c>'9';f|=(c=='-'),c = getchar());
	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0',c = getchar());
	if(f) x=-x;
}
int vis[110][2];
int n,m;
char s[110];
char M[110][110];
signed main()
{
	read(n),read(m);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s+1);
		for(int j=1;j<=m;j++)
			if(s[j]=='#')
				M[i][j]=1,vis[i][1]=vis[j][2]=1;
	}
	for(int i=1;i<=n;i++)
		if(vis[i][1])
		{
			for(int j=1;j<=m;j++)
				if(vis[j][2])
				{
					if(M[i][j]) printf("#");
					else printf(".");
				}
			puts("");
		}
	return 0;
}

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (l : _) <- map unsafeTextToDouble . T.words <$> T.getLine :: IO [Double]
  print $ l ^ 3 / 27

unsafeTextToDouble :: T.Text -> Double
unsafeTextToDouble s = case T.double s of
  Right (x, _) -> x


Measured memory_bytes: 508
#include<cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
    char a,b;
    while(~scanf("%c %c",&a,&b))
    {
        if(a=='H'&&b=='H')
            printf("H\n");
        else if(a=='D'&&b=='H')
            printf("D\n");
        else if(a=='D'&&b=='D')
            printf("H\n");
        else if(a=='H'&&b=='D')
            printf("D\n");
        getchar();
    }
    return 0;
}


Measured memory_bytes: 256
import sys
import bisect

n = int(sys.stdin.readline())
for z in xrange(n):
    order = sys.stdin.readline().strip()
    string = sys.stdin.readline().strip()
    
    half = len(string) / 2
    num = set(map(str, [0,1,2,3,4,5,6,7,8,9]))
    for o in order[::-1]:
#        print string, o
        if o == 'J':
            string = string[-1:] + string[:-1]
        elif o == 'C':
            string = string[1:] + string[:1]
        elif o == 'E':
            string = string[-half:] + string[:half] if half * 2 == len(string) or half == 0 else string[-half:] + string[half] + string[:half]
        elif o == 'A':
            string = string[::-1]
        elif o == 'P':
            temp = list(string)
            for i in xrange(len(temp)):
                if temp[i] in num:
                    temp[i] = str(int(temp[i]) + 10 - 1)[-1:]
            string = ''.join(temp)
        elif o == 'M':
            temp = list(string)
            for i in xrange(len(temp)):
                if temp[i] in num:
                    temp[i] = str(int(temp[i]) + 1)[-1:]
            string = ''.join(temp)
    print string

Measured memory_bytes: 4352
using System;
// using System.Collections.Generic;
// using System.Globalization;
// using System.IO;
// using System.Linq;
// using System.Text;
// using System.Text.RegularExpressions

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int ans = 0;
        for (int i = 1; i < N + 1; i++)
            if ((Math.Floor(Math.Log10(i)) + 1) % 2 == 1) ans++;
        Console.WriteLine(ans);
        return;
    }
}

Measured memory_bytes: 27676
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define u128 __int128
#define pb push_back

#define N 200010
#define MOD 1000000007


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
   cout.precision(10);

   int m, d;
   cin >> m >> d;
   int c = 0;
   for(int i = 1; i <= m; ++i)
   {
      for(int j = 1; j <= d; ++j)
      {
         int d1 = j % 10, d10 = j / 10;
         if(d1 >= 2 && d10 >= 2 && d1 * d10 == i)
            c++;
      }
   }
   cout << c << "\n";
   return 0;	 
}

      // while(b)
      // {
      //    if(b & 1)
      //    {
      //       an = (an * a);
            
      //       if(an > 1e18) 
      //          an /= 1e18;
      //    }
      //    a = (a * a);
      //    if(a > 1e18)
      //       a /= 1e18;
      //    b >>= 1;
      // }


Measured memory_bytes: 256
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def nextidx(h, x, y, dir):
    if y == h - 1 and dir == -1:
        return x + 1, y, 1
    elif y == 0 and dir == 1:
        return x + 1, y, -1
    else:
        return x, y - dir, dir


def main():
    h, w = nm()
    n = ni()
    A = nl()
    M = [[0] * w for _ in range(h)]
    dir = -1
    x = 0
    y = 0
    for i in range(n):
        for j in range(A[i]):
            M[x][y] = i + 1
            y, x, dir = nextidx(h, y, x, dir)
    for m in M:
        print(*m)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9520
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

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


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
list = list(map(int, input().split()))
ans = {}
for n_i in range(n):
    ans[list[n_i]] = n_i + 1
arrive_sorted = sorted(ans.items(), key=lambda x:x[0])
list_2 = []
for n_i in range(n):
    list_2.append(str(arrive_sorted[n_i][1]))
final_ans = ' '.join(list_2)
print(final_ans)

Measured memory_bytes: 31684
import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
        HashMap<String, Integer> map = new HashMap<String, Integer>();

        for(int i=0; i<N; i++){
            char[] a = sc.next().toCharArray();
            Arrays.sort(a);
            String s = new String(a);
            if(map.containsKey(s)){
                map.put(s, map.get(s) + 1);
            }
            else{
                map.put(s, 1);
            }
        }

        long ans = 0;
        for(int i:map.values()){
            ans += (long)i * (i - 1) / 2;
        }
        System.out.println(ans);
    }
}

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

int main() {
	int a[3][3], x[3], y[3];
	for (int i=0; i<3; i++){
	    for (int j=0; j<3; j++){
	        cin >> a[i][j];
	    }
	}
	x[0]=0;
	for (int i=0; i<3; i++) y[i]=a[0][i]-x[0];
	for (int i=0; i<3; i++) x[i]=a[i][0]-y[0];
	bool correct=true;
	for (int i=0; i<3; i++){
	    for (int j=0; j<3; j++){
	        if (x[i]+y[j]!=a[i][j]){
	            correct=false;
	        }
	    }
	}
	if (correct){
	    cout << "Yes" << endl;
	}
	else{
	    cout << "No" << endl;
	}
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

kab=0
mon=1000

for i in range(n-1):
    if a[i]<a[i+1]:
        x=mon//a[i]
        kab+=x
        mon-=x*a[i]
    else:
        mon+=kab*a[i]
        kab=0

mon+=a[-1]*kab

print(mon)

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    map<int, ll> mp;
    int N;
    cin >> N;
    int A[N];
    rep(i, N){
        cin >> A[i];
        mp[A[i]]++;
    }
    ll sum = 0;
    for(auto &e: mp){
        sum += e.second*(e.second-1)/2;;
    }
    rep(i, N){
        ll tmp = sum;
        tmp -= mp[A[i]]-1;
        cout << tmp << endl;
    }
}

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

int main(){
    int r, c;
    while(cin >> r >> c){
        if(r + c == 0)  break;

        int senbei[r][c];
        for(int i = 0; i < r; i++){
            for(int j = 0; j < c; j++){
                cin >> senbei[i][j];
            }
        }

        int ans = 0;
        for(int i = 0; i < (1<<r); i++){
            int flip = 0;
            for(int j = 0; j < c; j++){
                int partialFlip = 0;
                for(int k = 0; k < r; k++){
                    if((1<<k) & i){
                        if(senbei[k][j] == 1)   partialFlip++;
                    }else{
                        if(senbei[k][j] == 0)   partialFlip++;
                    }
                }
                partialFlip = max(partialFlip, r-partialFlip);
                flip += partialFlip;
            }
            ans = max(ans, flip);
        }

        cout << ans << endl;
    }

    return 0;
}


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

using namespace std;
using ll = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> A(N);
    for (int i=0;i<N;i++) cin >> A[i];
    map<ll, ll> B;
    for (int i=0;i<N;i++) {
        auto iter = B.find(A[i]);
        if (iter != B.end()) B[A[i]]++;
        else B.emplace(A[i],1);
    }
    ll res = 0;
    for (auto iter = B.begin(); iter != B.end(); iter++) { 
        res += (iter->second)*(iter->second -1) / 2;         
    }   
    for (int i=0;i<N;i++){
        res -= B[A[i]]-1;
        cout << res << "\n";
        res += B[A[i]]-1;
    }
    return 0;
}


Measured memory_bytes: 12672
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<long long, long long>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

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

vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;
	
	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i-1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

void dfs(int from) {
	int c = 1;
	for (auto t : tree[from]) {
		c = c != color[from] ? c : c + 1;
		color[t] = c;
		colorMap[make_pair(from, t)] = c;
		m = max(c, m);
		dfs(t);
		c++;
	}
}

int main() {
	double n;
	cin >> n;
	double a = n / 1.08;
	double a1 = (int)a;
	double a2 = a1 + 1;
	string ans = (int)(a1*1.08) == n ? to_string((int)a1) : (int)(a2*1.08) == n ? to_string((int)a2) : ":(";
	cout << ans << endl;	
}

Measured memory_bytes: 2560
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
//by NeighThorn
using namespace std;
const int maxn=10+5;
int n,a[maxn],ans;
inline int gcd(int x,int y){
	return y==0?x:gcd(y,x%y);
}
signed main(void){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	ans=a[1];
	for(int i=2;i<=n;i++)	
		ans=ans*a[i]/gcd(a[i],ans);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3236
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			int number = sc.nextInt();
			list.add(number);
		}
		
		int counter = 0;
		boolean listHasOdd = false;
		while(!listHasOdd) {
			for(int i = 0; i < list.size(); i++) {
				if(!(list.get(i) % 2 == 0)) {
					System.out.println(counter);
					listHasOdd = true;
					return;
				}
				int devidedNumber = list.get(i) / 2;
				list.set(i, devidedNumber);
			}
			counter++;
			
		}

		}

		
	}




Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
// aとbの最大公約数
long long gcd(long long a, long long b) {
    if(a % b == 0) {
        return (b);
    } else {
        return (gcd(b, a % b));
    }
}

// aとbの最小公倍数
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }

int main() {
    long long ans;
    int A, B;
    cin >> A >> B;
    ans = lcm(A,B);
    cout << ans << endl;
}

Measured memory_bytes: 256
"""
max(row)+max(col)が実現可能かを検証する。
row2とcol2の組み合わせの中から、爆弾が存在しないような座標の組み合わせを見つけたい。
しかし、全組み合わせを見ていては、時間が足りない。
爆弾ベースで調べられないか？
各i行目に対して、j列目はダメ、というのが
"""

H,W,M = map(int,input().split())
row = [0]*(H)
col = [0]*(W)
memo = set()
bombMemoRow = {}
for _ in range(M):
    h,w = map(int,input().split())
    row[h-1] += 1
    col[w-1] += 1
    memo.add((h-1,w-1))
    if h-1 not in bombMemoRow:
        bombMemoRow[h-1] = []
    bombMemoRow[h-1].append(w-1)

rowMax = max(row)
colMax = max(col)
row2 = []
for i in range(H):
    if row[i] == rowMax:
        row2.append(i)

col2 = []
for i in range(W):
    if col[i] == colMax:
        col2.append(i)
col2Copy = col2[:]
col2 = set(col2)
col2Copy = set(col2Copy)

for r in row2:
    for c in bombMemoRow[r]:
        if c in col2:
            col2.remove(c)
    if len(col2) >= 1:
        print(rowMax+colMax)
        exit()
    for c in bombMemoRow[r]:
        if c in col2Copy:
            col2.add(c)
print(rowMax+colMax-1)

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    int n;
    cin>>n;
    vector<int> ws(n);
    rep(i, n) cin>>ws[i];
    vector<int> s;
    s.push_back(0);
    rep(i, n) {
        s.push_back(s[i] + ws[i]);
    }

    int m = INT_MAX;
    rep(i, n + 1) {
        int a = s[i];
        int b = s[n] - s[i];
        if (m > abs(a - b)) m = abs(a - b);
    }

    cout<<m<<endl;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < n; i++)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string SA, SB, SC;
    cin >> SA >> SB >> SC;

    // 0 A, 1 B, 2 C
    int state = 0;
    bool flag = false;
    char ans;
    while(true) {
        switch(state) {
            case 0:
                if (SA.empty()) {
                    flag = true;
                    ans = 'A';
                    break;
                }
                if (SA[0] == 'a') {
                    state = 0;
                } else if (SA[0] == 'b') {
                    state = 1;
                } else if (SA[0] == 'c') {
                    state = 2;
                }
                SA.erase(SA.begin());
                break;
            case 1:
                if (SB.empty()) {
                    flag = true;
                    ans = 'B';
                    break;
                }
                if (SB[0] == 'a') {
                    state = 0;
                } else if (SB[0] == 'b') {
                    state = 1;
                } else if (SB[0] == 'c') {
                    state = 2;
                }
                SB.erase(SB.begin());
                break;
            case 2:
                if (SC.empty()) {
                    flag = true;
                    ans = 'C';
                    break;
                }
                if (SC[0] == 'a') {
                    state = 0;
                } else if (SC[0] == 'b') {
                    state = 1;
                } else if (SC[0] == 'c') {
                    state = 2;
                }
                SC.erase(SC.begin());
                break;
            default:
                break;
        }
        if (flag) {
            break;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] a = sc.nextLine().split(" ");
        int small = Integer.parseInt(a[0]);
        int large = Integer.parseInt(a[1]);
        int count = 0;
        //System.out.println(small +"."+ large);
        for(int i=small ; i <= large ; i++){
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 28628
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int total = scan.nextInt();
    int noguti = 0;
    if(total < 1000){
     System.out.print(1000- total);
    }
    if(total > 999 && total % 1000 == 0){
     System.out.print(0);
    }
    if(total > 999 && total % 1000 != 0){
     noguti = (total/1000)+ 1;
    System.out.print(1000*noguti - total);
    }    
  }
}

Measured memory_bytes: 35572
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int bmax=0,max=0;

		for(int i=0;i<s.length();i++) {
			for(int j=i;j<s.length();j++) {
				if(s.substring(j,j+1).equals("A")||s.substring(j,j+1).equals("C")||s.substring(j,j+1).equals("G")||s.substring(j,j+1).equals("T")) {
					max++;//ACGT
				}else {
					break;
				}
			}
			if(max>=bmax)bmax=max;
			max=0;
		}
		System.out.println(bmax);
	}
}

//Arrays.sort(array, (a, b) -> Integer.compare(a[0], b[0]));




Measured memory_bytes: 21588
require 'pp'
n = gets.to_i
a = gets.split.map(&:to_i)

abs = nil

ruiseki_migi = [0]
tmp = 0
n.times do |i|
  tmp += a[i]
  ruiseki_migi << (tmp)
end
ruiseki_hidari = []
tmp = 0
n.times do |i|
  tmp += a[n-i-1]
  ruiseki_hidari << (tmp)
end
ruiseki_hidari.reverse!
ruiseki_hidari << 0

p ruiseki_migi.zip(ruiseki_hidari).map{|x|(x[0]-x[1]).abs}.min


Measured memory_bytes: 31368
#include <iostream>
#include <iomanip>
#include <cstring>
#include <stack>
using namespace std;

int main(){
	string str;
	while(getline(cin,str)){
		stack<int> st;
		bool ok = true;
		if(str.size() == 1 && str[0] == '.') break;
		for(int i = 0; i < str.size(); i++){
			if(str[i] == '(') st.push(1);
			else if(str[i] == '[') st.push(2);
			else if(str[i] == ')'){
				if(st.size()==0||st.top() != 1){
					ok = false;
					break;
				} else{
					st.pop();
				}
			}
			else if(str[i] == ']'){
				if(st.size()==0||st.top() != 2){
					ok = false;
					break;
				} else{
					st.pop();
				}
			}
		}
		if(st.size() != 0) ok = false;
		if(ok) cout << "yes" << endl;
		else cout << "no" << endl;
	}
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define debug(x) cerr << #x << " = " << x << endl


int main(int qtd, char* nome[])
{
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	int a, b, c;
	cin >> a >> b >> c;
	cout << c << ' ' << a << ' ' << b << '\n';
	
	return 0;
}

Measured memory_bytes: 3588
x,n = map(int, input().split())
A = list(map(int, input().split())) 

pre = A[len(A)-1] 
m = x-pre+A[0]
s = m
#print ("最初",pre,m,s)

pre = A[0]

for a in A[1:]:
    m = max([a - pre , m])
    s = s +  a - pre
    
    #print (a,pre,m,s)
    pre = a
    
    
print(s-m)

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

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

  vector<int> ans(N, -1);
  bool ng = false;
  for(int i = 0; i < M; i++){
    int s_, c_;
    cin >> s_ >> c_;
    s_--;
    if(ans[s_] != -1 && ans[s_] != c_){
      ng = true;
    }
    ans[s_] = c_;
  }

  if(N != 1 && ans[0] == 0){
    ng = true;
  }

  if(ng){
    cout << -1 << endl;
  }else{
    if(N == 1){
      if(ans[0] == -1){
        cout << 0 << endl;
      }else{
        cout << ans[0] << endl;
      }
    }else{
      for(int i = 0; i < N; i++){
        if(i == 0){
          if(ans[0] == -1){
            cout << 1;
          }else{
            cout << ans[0];
          }
        }else{
          if(ans[i] == -1){
            cout << 0;
          }else{
            cout << ans[i];
          }
        }
      }
      cout << endl;
    }
  }
}

          
  


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


int main() {
  char a;
  cin >> a;
  cout << (a <='Z'? "A" : "a") << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <complex>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main() {
    int i,j,k,l;
    int a,b,c;
    int min,cost;
    float r,rmin;
    float resmin,res1;
    vector<float> res(100);
    a = 0;
    while(1){
        cin >> min >> cost;
        if(min==0&&cost==0){
            break;
        }
        r = min;
        resmin = fabs(r - cost);
        for(i=1;i<min;i++){
            r = sqrt((min-i)*(min-i) + (i)*(i));
            res1 = fabs(r - cost);
            if(res1<resmin){
                resmin = res1;
            }
        }
        res[a] = resmin;
        a++;
    }    

    REP(i,a){
        cout << res[i] << endl;
    }

}


Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << (3 * a + b) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final int lowerLimit = 0;
		final int upperLimit = 1000000;
		int num1, num2;
		Scanner scan = new Scanner(System.in);
		
		while(scan.hasNext()) {
			num1 = scan.nextInt();
			num2 = scan.nextInt();
			
			if((num1 >= lowerLimit && num1 <= upperLimit)
				&& (num2 >= lowerLimit && num2 <= upperLimit)) {
				System.out.println((int)Math.log10(num1 + num2) + 1);		
			} else {
				continue;
			}
		}
	}
}

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

using namespace std;

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

  int sn = 0;
  int n=atoi(in.c_str());
  for( int i=0;i<in.length(); i++)
    {
      sn += int(in[i]-'0');
    }

  if( n%sn == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD 1000000007
#define P pair<ll, ll>


struct FenwickTree {
  vector<long long> v;
  int n;
  FenwickTree(int n) : n(n), v(n) {}
  void add(int i, long long x) {
    i++;
    while (i <= n) {
      v[i - 1] += x;
      i += i & -i;
    }
  }
  long long get(int i) {
    long long r = 0;
    while (i >= 1) {
      r += v[i - 1];
      i -= i & -i;
    }
    return r;
  }
};
 
struct ExFenwickTree {
  FenwickTree p, q;
  ExFenwickTree(int n) : p(n + 1), q(n + 1) {}
  void add(int l, int r, long long w) {
    p.add(l, -w * l);
    p.add(r, w * r);
    q.add(l, w);
    q.add(r, -w);
  }
  long long get(int r) {
    return p.get(r) + q.get(r) * r;
  }
  long long sum(int r) {
      if (r == 0) return get(r);
      return get(r) - get(r - 1);
  }

};

ExFenwickTree seg(210000);
int main() {
    ll n, k;
    cin >> n >> k;
    //n = 200000;
    //k = 200000;
    vector<ll> s(n);
    REP(i, n){
        cin >> s[i];
        seg.add(max(0ll, i - s[i]), min(n - 1, i + s[i]) + 1, 1);
    }
    bool ok;
    ll now = 0;
    vector<ll> t(n);
    REP(j, k){
        now++;
        REP(i, n){
            ok = false;
            t[i] = seg.sum(i + 1);
            if (t[i] < n) ok = true;
        }
        REP(i, n){
            seg.add(max(0ll, i - s[i]), min(n - 1, i + s[i]) + 1, -1);
            seg.add(max(0ll, i - t[i]), min(n - 1, i + t[i]) + 1, 1);
            s[i] = t[i];
        }
        if (!ok) break;
        //cout << seg.sum(1) << endl;
    }
    REP(i, n){
        if (i != 0) printf(" ");
        printf("%d", (int)s[i]);
    }
    cout << endl;
}


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

int main(){
  int N,K;
  cin >> N >> K;
  set<int> s;
  for(int i=0;i<K;i++){
    int d;
    cin >> d;
    for(int j=0;j<d;j++){
      int A;
      cin >> A;
      s.insert(A);
    }
  }
  cout << N-s.size() << endl;
  return 0;
}


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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

int solve(int a, int l) {
    string sa = to_string(a);
    sort(ALL(sa));
    int amin = stoi(sa);
    reverse(ALL(sa));
    for(int i=sa.size(); i<l; ++i) sa += "0";
    int amax = stoi(sa);
    return amax - amin;
}

int main()
{
    int a, l;
    while(cin>>a>>l, a||l) {
        vector<int> v;
        while(true) {
            auto it = find(ALL(v),a);
            if(it!=v.end()) {
                cout << distance(v.begin(), it) << " " << a << " " << v.size()+1-(distance(v.begin(), it)+1) << endl;
                break;
            }
            v.push_back(a);
            a = solve(a,l);
        }
    }
    return 0;
}

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

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

int main(){
    int h,w;
    cin>>h>>w;
    vector<string> a(h);
    for(int i=0;i<h;i++) cin>>a[i];
    queue<pair<int,int>> q;
    if(a[0][0]=='#'){
        q.push(make_pair(0,0));
        a[0][0]='.';
    }
    while(!q.empty()){
        int x=q.front().first;
        int y=q.front().second;
        q.pop();
        for(int i=0;i<2;i++){
            int nx=x+dx[i];
            int ny=y+dy[i];
            if(nx>=w||ny>=h||a[ny][nx]=='.') continue;
            a[ny][nx]='.';
            q.push(make_pair(nx,ny));
            break;
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(a[i][j]=='#'){
                cout<<"Impossible"<<endl;
                return 0;
            }
        }
    }
    cout<<"Possible"<<endl;
}

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

P=[True for _ in range(55556)]
P[0]=False
P[1]=False

for i in range(len(P)):
  if P[i]:
    cnt=2
    while i*cnt<=55555:
      P[i*cnt]=False
      cnt+=1
ans=0
for i in range(len(P)):
  if P[i] and i%5!=1:
    P[i]=False

cnt=0
for i in range(len(P)):
  if P[i]:
    cnt+=1
    if cnt==N:
      print(i)
      break
    else:
      print(i,end=' ')

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define MAX_N 200001
#define mod 1000000007
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
ll n, x;
vector<ll> divisor_x;

signed main(){
    cin >> x;
    // for(ll i=1; i*i<=x; i++){
    //     if(x % i == 0) divisor_x.pb(i);
    // }
    // divisor_x.pb(x);

    for(ll a=1; a <= 1000; a++){
        // for(ll d: divisor_x){
        //     ll b = a - d;
        for(ll b=0; b<=1000; b++){
            if(a*a*a*a*a - b*b*b*b*b == x){
                cout << a << ' ' << b << endl;
                return 0;
            }
            if(a*a*a*a*a + b*b*b*b*b == x){
                cout << a << ' ' << -b << endl;
                return 0;
            }
        }
    }
    cout << "fail" << endl;
    return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
int R;
int main (void){
    int r=scanf("%d",&R);
    if(R>=0&&R<1200){
        printf("ABC");
    }else if(R>=1200&&R<2800){
        printf("ARC");
    }else{
        printf("AGC");
    }
    return 0;
}

Measured memory_bytes: 128
//https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_d
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
    ll M; cin>>M;
    ll sum=0;
    ll keta=0;
    REP(i,M){
        ll d,c; cin>>d>>c;
        sum += d*c;
        keta+=c;
    }
    ll ans=(sum-1)/9+keta-1;
    cout<<ans<<endl;
    return 0;
}

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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    string s; cin >> s;
    int n = s.size();
    vl a(n+1,0);
    for(int i=0;i<n;i++){
        if(s[i] == '<')chmax(a[i+1],a[i]+1);
    }
    for(int j=n-1;j>=0;j--){
        if(s[j] == '>')chmax(a[j],a[j+1]+1);
    }
    cout << accumulate(all(a),0LL) << endl;
}

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

struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>> ;
using GraphEdge = vector<vector<int>> ;

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}

const int MAXH=300001;
const int MAXW=300001;
int main(){
    int H,W,M;cin >> H >> W >> M;
    ll tate[MAXW];
    ll yoko[MAXH];
    bool onw[MAXW];
    bool onh[MAXW];

    memset(onw, false, sizeof(onw));  
    memset(onh, false, sizeof(onh));  
    memset(tate, 0, sizeof(tate));
    memset(yoko, 0, sizeof(yoko));
    int h[MAXH];
    int w[MAXW];
    rep(i,M){
        cin >> h[i] >> w[i];
        tate[w[i]]++;
        yoko[h[i]]++;
    }
    ll ans = 0;
    ll maxw=0,maxh=0;
    ll x=0,y=0;
    Rep(i,W){
        maxw = max(tate[i],maxw);
    }
    Rep(i,W){
        if(maxw==tate[i]){
            onw[i] = true;
            x++;
        }
    }

    Rep(i,H){
        maxh = max(maxh,yoko[i]);
    }

    Rep(i,H){
        if(maxh==yoko[i]){
            onh[i] = true;
            y++;
        }
    }

    ans = x*y;
    rep(i,M){
        if(onw[w[i]] && onh[h[i]]){
            ans--;
        }
    }

    // ll tma = maxh+maxw;
    if(ans>0)cout << maxh+maxw << endl;
    else cout << maxh+maxw-1 << endl;

    return 0;
}

Measured memory_bytes: 11240
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;

int main(){
   int n, a, b;
   cin >> n >> a >> b;
   int res = ((a + b - n) < 0) ? 0 : (a + b - n);
   cout << min(a,b) << " " << res << endl;


  return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int b[999999], n, c[999999];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	b[1] = 0;
	for (int i = 2; i <= n; i++) {
		b[i] = b[i / 2] + b[(i + 1) / 2] + i;
	}
	sort(c, c + n);
	for (int i = 0; i < n; i++) {
		cout << c[i];
		if (i < n - 1) {
			cout << ' ';
		}
		else { cout << endl; }
	}
	cout << b[n] << endl;
	return 0;
}

Measured memory_bytes: 7020
def factorization(n):
    m=n
    counter_map={}
    i=2
    tmp=1
    while n!=1:
        #因数に持つか判定
        if n%i==0:
            n=n//i
            #素数判定
            for j in range(2,int(i**(1/2))+1):
                if i%j==0:
                    break
            else:
                tmp*=i
                if i not in counter_map:
                    counter_map[i]=1
                    tmp=1
                else:
                    if tmp not in counter_map:
                        counter_map[tmp]=1
                        tmp=1
        else:
            i+=1
            tmp=1
        if i>int(m**(1/2)) and n!=1:
            counter_map[n]=1
            break
        #print(i,n,counter_map)
    return counter_map


a=int(input())
b=factorization(a)
#print(b)
print(len(b))


Measured memory_bytes: 64900
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <numeric>
#include <algorithm>
#include <utility>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


ll gcd(ll a, ll b) {
    while (b != 0) {
        auto tmp = a;
        a = b;
        b = tmp % a;
    }
    return a;
}

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


void oneCase () {
    int n;
    cin >> n;
    map<string, int> mp;
    int best = 0;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        ++mp[s];
        best = max(best, mp[s]);
    }
    vector<string> b;
    for (auto p : mp) {
        if (p.second == best) {
            b.push_back(p.first);
        }
    }
    sort(b.begin(), b.end());
    for (auto line : b) {
        cout << line << "\n";
    }


}




int main() {
    int t = 1;
//    cin >> t;
    while (t > 0) {
        oneCase();
        --t;
    }

    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);

  int n;
  cin >> n;

  int ans = 1, mcnt = 0;
  for (int i = 1; i <= n; ++i) {
    int j = i, cnt = 0;
    while (j % 2 != 1) {
      j /= 2;
      ++cnt;
    }
    if (mcnt < cnt) {
      mcnt = cnt;
      ans = i;
    }
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll A,B,C;
    cin >> A >> B >> C;
    OutputAnswerBool((C-A-B) > 0 && 4*A * B < (C-A-B)*(C-A-B));
}


Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>

using namespace std;
int main()
{
	string s;
	int N = 0;
	int Ans = 0;
	int counter = 0;

	cin >> N;
	cin >> s;

	for (int k = 1; k < N; k++) {
		counter = 0;
		for (char i = 'a'; i <= 'z'; i++) {
			bool left = false;
			bool right = false;

			for (int j = 0; j < k; j++) {
				if (s[j] == i) {
					left = true;
				}
			}
			for (int j = k; j < N; j++) {
				if (s[j] == i) {
					right = true;
				}
			}

			if (left == true && right == true) {
				counter++;
			}
			if (Ans < counter) {
				Ans = counter;
			}
		}
	}

	cout << Ans;

	return 0;
}

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

int main() {
	int n;
	cin >> n;
	long int s[n];
	for(int i=0;i<n;i++){
		cin >> s[i];
	}
	
	long int pos = 0;
	long int neg = 0;
	long int tmpsum = 0;
	
	for(int i=0;i<n;i++){
		if(i%2==0){
			tmpsum = tmpsum + s[i];
			if(tmpsum <= 0){
				pos = pos +1 - tmpsum ;
				tmpsum = 1;
			}	
		}
		else{
			tmpsum = tmpsum + s[i];
			if(tmpsum >=0){
				pos = pos + tmpsum + 1;
				tmpsum = -1;
			}
			
		}
	}
	
	tmpsum = 0;
	
	for(int i=0;i<n;i++){
		if(i%2==0){
			tmpsum = tmpsum + s[i];
			if(tmpsum >= 0){
				neg = neg +1 + tmpsum ;
				tmpsum = -1;
			}	
		}
		else{
			tmpsum = tmpsum + s[i];
			if(tmpsum <=0){
				neg = neg +1 - tmpsum ;
				tmpsum = 1;
			}
			
		}
	}
	
	if(pos > neg) { cout << neg << endl;}
	else { cout << pos << endl;}
	
	
	return 0;
}

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

int main(void){
  int n;
  cin >> n;
  int m = n;
  int sum = 0;
  if(m > 99999){
    sum += 9 + 900 + 90000; 
  }
  else if(m > 9999){
    sum += m - 9999;
    sum += 9 + 900; 
  }
  else if(m > 999){
    sum += 9 + 900;
  }
  else if(m > 99){
     sum += m-99;
     sum += 9;
  }
  else if(m > 9){
    sum += 9;
  }
  else{
    sum += m;
  }
  
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
	long n,i,temp;
	bool flag=1;
	vector<long> h;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>temp;
		h.push_back(temp);
	}
	for(i=n-2;i>=0;i--){
		if(h.at(i)>h.at(i+1)){
			h.at(i)--;
		}
	}
	for(i=0;i<n-1;i++){
		if(h.at(i)>h.at(i+1)){
			flag=0;
			break;
		}
	}
	if(flag){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
	return 0;
}



Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

typedef long long ll;
typedef pair<ll, ll> P;

//const int MAX = 700000;
//static const ll MOD = 1000000007;
//static const ll INF = 100000000;

int main() {
    ll N, answer = 0;
    
    // input
    cin >> N;

    // process
    double X = (double) (N + 1) / 1.08;
    X = floor(X);
    ll alt_N = X * 1.08;

    if (alt_N == N) {
        cout << X << endl;
    } else {
        cout << ":(" << endl;
    }

    return 0;
}

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

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back

/* add vars here */

ll n,k;

/* add your algorithm here */

int main() {
  cin >> n >> k;
  ll c = 0;

  for (int i = 1; i <= n; ++i) {
    if (i % k == 0) {
      ++c;
    }
  }

  ll ans = 1;
  ans = c * c * c;
  if (!(k % 2)) {
    ll t = k / 2;
    ll cd = 0;

    for (int i = 1; i <= n; ++i) {
      if (i % k == t) {
        cd++;
      }
    }

    ans += cd * cd * cd;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256