akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int a, b;
    cin >> a >> b;
    if (a < b)
    {
        for (int i = 0; i < b; i++)
        {
            cout << a;
        }
        cout << "\n";
    }
    else
    {
        for (int i = 0; i < a; i++)
        {
            cout << b;
        }
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//戻る作業は必要ない。その飛び方を使うか使わないかが問題→時刻iまでではiまでの総和以下の数値分の移動は実現可能。

int sum(int n) {
  if (n == 1) {
    return 1;
  }
 
  int s = sum(n - 1);
  return s + n;
}//1~nまでの総和


int main() {
  int X,ans;

  cin >> X ;


  for(int i=1;i<=X;i++){
    int s=sum(i);
    if(X<=s){ans=i; break;}
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;

#define endl "\n"
typedef long long int ll;

inline void fastio(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
inline void setPrecision(int n){cout.precision(n);}

ll INF = 1e10;
int MOD = 1e9+7;

int main(){
	fastio();
	int n,k;
	cin>>n>>k;
	vector<ll> v(n+1);
	vector<int> w(n+1);
	for(int i=1;i<=n;++i) cin>>w[i]>>v[i];
	vector<vector<ll>> dp(2,vector<ll>(k+1, -1e18));
	for(int i=0;i<=k;++i)
		dp[0][i] = 0;
	dp[1][0] = 0;
	for(int i=1;i<=n;++i)
		for(int j=0; j<=k; ++j){
			dp[i%2][j] = max(dp[i%2][j],dp[(i-1)%2][j]);
			if(j >= w[i]) dp[i%2][j] = max(dp[i%2][j], dp[(i-1)%2][j-w[i]] + v[i]);
		}
	ll mx = 0;
	for(int i=0;i<=k;++i) mx = max(mx,dp[n%2][i]);
	cout<<mx;
    return 0;
}

Measured memory_bytes: 5584
from collections import defaultdict
# d = defaultdict(int)で0で初期化
# d = defaultdict(lambda: 100)で100で初期化
MAXN = 10**6 + 10
sieve = [i for i in range(MAXN + 1)]
p = 2
while p * p <= MAXN:
    if sieve[p] == p:
        for q in range(2 * p, MAXN + 1, p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1


def solve(a):
    tmp = defaultdict(int)
    while a > 1:
        tmp[sieve[a]] += 1
        a //= sieve[a]
    ans = 1
    for i in tmp.values():
        ans *= (i + 1)
    return ans


n = int(input())
ans = 0
for i in range(1, n):
    ans += solve(i)
print(ans)


Measured memory_bytes: 143372
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void day_count(char*day){
    if(day[0]=='S' & day[1]=='U'){
        printf("7");
    }
    else if(day[0]=='M' & day[1]=='O'){
        printf("6");
    }
    else if(day[0]=='T' & day[1]=='U'){
        printf("5");
    }
    else if(day[0]=='W' & day[1]=='E'){
        printf("4");
    }
    else if(day[0]=='T' & day[1]=='H'){
        printf("3");
    }
    else if(day[0]=='F' & day[1]=='R'){
        printf("2");
    }
    else if(day[0]=='S' & day[1]=='A'){
        printf("1");
    }
}


int main() {
    char day[50];
    scanf("%s",day);

    day_count(day);


    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>

using namespace std;
int main() {
   int a1,b1,a2,b2,a3,b3,a4,b4,side,up;
   cin >> a1 >> b1 >> a2 >> b2;
   side = a2 - a1;
   up = b2 - b1;
   a3 = a2 - up;
   b3 = b2 + side;
   a4 = a3 - side;
   b4 = b3 - up;
  
   cout << a3 << " " << b3 << " " << a4 << " " << b4 << endl;
}  

Measured memory_bytes: 256
import java.util.Scanner;

class A {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final char[] S = sc.next().toCharArray();
        boolean success = S.length % 2 == 0;
        for (int i = 0; i < S.length && success; i += 2)
            success = (S[i] == 'h' && S[i + 1] == 'i');
        System.out.println(success ? "Yes" : "No");
    }
}
public class Main {
    public static void main(String... args) {
        A.main();
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#pragma region atcoder
//using mint = modint998244353;
//These are for segment tree
/*int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}
*/
#pragma endregion
#pragma region macros
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n - 1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion
const ll mod = 998244353;
const int inf = 1001001001;
const ll INF = 1001001001001001001;
const int MAX = 2000005;

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

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; }
ll modpow(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;}

/*--------------------------------------------------------------------------------------------------------------------------------*/

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
    int N, C; cin >> N >> C;
    vi s(N), t(N), c(N);
    vvi broadcast(C+1, vi(100002, 0));
    rep(i,N){
        cin >> s[i] >> t[i] >> c[i];
        s[i]--;
        broadcast[c[i]][s[i]]++;
        broadcast[c[i]][t[i]]--;
    }
    for(int i = 1; i <= C; i++){
        rep(j, 100001) broadcast[i][j + 1] += broadcast[i][j];
        //for(int j = 1; j < 100; j++) cout << broadcast[i][j];
        //cout << endl;
    }
    int ans = 0;
    rep(i, 100002){
        int tmp = 0;
        for(int j = 1; j <= C; j++){
            tmp += (broadcast[j][i] != 0 ? 1 : 0);
        }
        //if(tmp == 3) cout << i << endl;
        ans = max(tmp, ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 16920
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
typedef long long ll;
typedef vector<ll> vll;
const int inf = 1e9;
int main(){
    ll n, w, s = 0;
    cin >> n >> w;
    vector<ll> val(n), wei(n);
    rep(i,n){
        cin >> val[i] >> wei[i];
        s += val[i];
    }
    vector<ll> dp(s+1, inf);
    dp[0] = 0;
    rep(i,n)for(int j=s;j>=val[i];j--)dp[j] = min(dp[j], dp[j - val[i]] + wei[i]);
    
    int ret = 0;
    for(int i=0;i<=s;i++)if(dp[i] <= w)ret = max(ret, i);
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long int
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int N = 2e5 + 5;
const int oo = 1e9 + 5;
const LL ooll = (LL)1e18 + 5;
const int MOD = 1e9 + 7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l, r) uniform_int_distribution<int>(l, r)(rng)

clock_t start = clock();

vector<int> g[N];
int viscnt, vis[N];
void dfs(int node) {
    vis[node] = 1;
    viscnt++;
    for (auto it : g[node]) if (!vis[it]) {
        dfs(it);
    }
}

void solve() {
    int n, m;
    cin >> n >> m;
    for (int i=1;i<=n;++i) {
        g[i].clear();
        vis[i] = 0;
    }
    for (int i=0;i<m;++i) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    int ans = 0;
    for (int i=1;i<=n;++i) if (!vis[i]) {
        viscnt = 0;
        dfs(i);
        ans = max(ans, viscnt);
    }
    cout << ans << '\n';
}

int main() {
    FASTIO;
    int T = 1;
    // cin >> T;
    for (int t=1;t<=T;++t) {
        solve();
    }
    // cerr << fixed << setprecision(10);
    // cerr << (clock() - start) / ((long double)CLOCKS_PER_SEC) << '\n';
    return 0;
} 

Measured memory_bytes: 21592
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

typedef long long LL;
const int INF=0x3f3f3f3f;
const int M=1e5+5;
const int MC=26;
char s[M],t[M];
int nxt[M][MC];

// inline void ckmin(int &x,int y)
// {
// 	if(x>y) x=y;
// }

int main()
{
	scanf("%s%s",s+1,t);
	int n=strlen(s+1);
	int m=strlen(t);
	for(int i=0;i<26;i++)
		nxt[0][i]=INF;
	for(int i=n;i;i--)
	{
		for(int j=0;j<26;j++)
			nxt[i-1][j]=nxt[i][j];
		nxt[i-1][s[i]-'a']=i;
	}
	int p=0;
	LL ans=0;
	for(int i=0;i<m;i++)
	{
		p=nxt[p][t[i]-'a'];
		if(p==0)
		{
			ans+=n;
			p=nxt[p][t[i]-'a'];
		}
		if(p==0)
		{
			ans=-1;
			break;
		}
		//cout<<p<<endl;
	}
	printf("%lld\n",ans==-1?-1:ans+p);
	return 0;
}

Measured memory_bytes: 10624
import itertools
from collections import deque,Counter
n,x,y = map(int,input().split())
route=[[10**10]*(n+1) for i in range(n+1)]
for i in range(1,n+1):
  q=deque([i])
  j=i
  route[i][j]=0
  while q:
    j=q.pop()
    if j == y:
      if route[i][j]+1 < route[i][x]:
        route[i][x]=route[i][j]+1
        q.append(x)
    if j == x:
      if route[i][j]+1 < route[i][y]:
        route[i][y]=route[i][j]+1
        q.append(y)
    if 1 < j:#-1
      if route[i][j]+1 < route[i][j-1]:
        route[i][j-1]=route[i][j]+1
        q.append(j-1)
    if j < n:#+1
      if route[i][j]+1 < route[i][j+1]:
        route[i][j+1]=route[i][j]+1
        q.append(j+1)

ans=Counter(list(itertools.chain.from_iterable(route)))
for i in range(1,n):
  print(ans[i]//2)


Measured memory_bytes: 174252
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
ll dp[100001];
int q(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
int main(void) {
  int w,h,c;
  scanf("%d %d %d",&w,&h,&c);
  PRN(c*w*h/(int)pow(gcd(max(w,h),min(w,h)),2));
  return 0;
}


Measured memory_bytes: 2140
#include <iostream>
#include <list>
#include <string>
#include <ios>
using namespace std;
struct Trie
{
	struct Node
	{
		Node() :isEnd(false) {}
		Node(char _v) : v(_v), isEnd(false) {}
		~Node()
		{
			for (list<Node*>::iterator it = nodes.begin();
				it != nodes.end();
				++it)
			{
				delete *it;
			}
		}
		Node* FindChild(char c){
			for (list<Node*>::iterator it = nodes.begin();
				it != nodes.end();
				++it)
			{
				if ((*it)->v == c)
					return *it;
			}
			return 0;
		}

		bool isEnd;
		char v;
		list<Node*> nodes;
	};

	void Add(const string& str){
		Node* n = &root;
		Node* cn = 0;
		int s = str.size();
		std::string::size_type p = 0;
		for (; p < s; ++p){
			char c = str[p];
			cn = n->FindChild(c);
			if (cn)
				n = cn;
			else{
				cn = new Node(c);
				n->nodes.push_back(cn);
				n = cn;
			}
		}
		n->isEnd = true;
	}
	bool Find(const string& str){
		Node* n = &root;
		Node* cn = 0;
		int s = str.size();
		std::string::size_type p = 0;
		for (; p < s; ++p){
			char c = str[p];
			cn = n->FindChild(c);
			if (!cn)
				return false;
			n = cn;
			if (p == s - 1)
				return n->isEnd;
		}
	}
	Node root;
};

int main()
{
	ios::sync_with_stdio(false);

	int n, i;
	cin >> n;
	string com, str;
	Trie trie;
	for (i = 0; i < n; ++i){
		cin >> com >> str;
		if (com == "insert") trie.Add(str);
		if (com == "find")
			cout << (trie.Find(str) ? "yes\n" : "no\n");
	}

	return 0;
}

Measured memory_bytes: 22956
#include <bits/stdc++.h>
typedef long long ll; 
const ll mod = 1e9+7;
#define fo(i, n) for (int i = 0; i < n; i++)
#define sc(n) scanf("%d", &n) 
using namespace std;

bool isPalin(string s, int start, int end) {
    
    while (start < end) {
        if (s[start] != s[end]) return false;
        start++;
        end--;
    }
    return true;

}

void solve() {
    string s;
    cin >> s;
    int n = s.size();
    if (isPalin(s, 0, n-1) && isPalin(s, 0, (n-1)/2-1) && isPalin(s, (n+3)/2-1, n-1)) printf("Yes");
    else printf("No");

}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long d = sc.NextLong();
        long[] c = sc.LongArray();
        long[,] s = new long[d, 26];
        for (int i = 0; i < d; i++)
        {
            for (int j = 0; j < 26; j++)
            {
                s[i, j] = sc.NextLong();
            }
        }

        long[] last = new long[26];

        for (int i = 0; i < d; i++)
        {
            long maxDiff = long.MinValue;
            long answerIndex = 0;
            long secondDiff = long.MinValue;
            long secondIndex = 0;
            long nextMaxScore = 0;
            for (int j = 0; j < 26; j++)
            {
                long diff = 0;
                diff += s[i, j];
                diff += c[j] * (i + 1 - last[j]);
                if (diff > maxDiff)
                {
                    secondDiff = maxDiff;
                    maxDiff = diff;
                    secondIndex = answerIndex;
                    answerIndex = j;
                }
                if (i != d - 1 && s[i + 1, j] > nextMaxScore)
                {
                    nextMaxScore = s[i + 1, j];
                }
            }
            if ((i != d - 1) && (s[i + 1, answerIndex] > s[i, answerIndex] + 1000) && (s[i + 1, answerIndex] == nextMaxScore))
            {
                answerIndex = secondIndex;
            }
            last[answerIndex] = i;
            Console.WriteLine(answerIndex + 1);
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 28852
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
using namespace std;

int main(){
	double pi=3.141592;
	double r;
	cin>>r;
	cout<<setprecision(10)<<(r*2)*pi<<endl;
	return 0;
}

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

using int64 = long long;

const int TEST = 9;

int main() {
    // 桁数を特定
    int S = 100, T = 100;

    int64 X = 1, Y = 9;
    for (int i = 0; i <= TEST; i++) {
        string res;

        cout << "? " << X << endl;
        cin >> res;
        if (res == "Y") S = i;

        cout << "? " << Y << endl;
        cin >> res;
        if (res == "N") T = i + 1;

        X = X * 10;
        Y = Y * 10 + 9;
    }

    // cerr << "S: " << S << " T: " << T << endl;

    int digits = min(S, T);

    if (S == TEST and T == 100) digits = 0;

    int64 ans = 0;
    // cerr << "digits: " << digits << endl;

    for (int i = 0; i < digits; i++) {
        // 二分探索
        int ok = (i == 0);
        int ng = 10;

        string res;
        while (ng - ok > 1) {
            int mid = (ok + ng) / 2;
            cout << "? " << ans + mid << endl;
            cin >> res;

            if (res == "Y") ok = mid;
            else ng = mid;
        }
        ans += ok;
        ans *= 10;
    }

    int ok = 9;
    int ng = (digits == 0) ? 0 : -1;

    string res;
    while (ok - ng > 1) {
        int mid = (ok + ng) / 2;
        cout << "? " << (ans + mid) * 10 << endl;
        cin >> res;

        if (res == "Y") ok = mid;
        else ng = mid;
    }
    ans += ok;

    cout << "! " << ans << endl;

    return 0;
}

Measured memory_bytes: 692
#include<stdio.h>






int main()
{


int n;

scanf("%d",&n);

int arr[4];
int i;

	arr[0]=n%10;
	n/=10;
	for(i=1;i<4;i++)
	{
	
	arr[i]=n%10;
	if(arr[i]==arr[i-1])
	{printf("Bad\n");
	break;}

	n/=10;	
	
	}

	if(i==4)
		printf("Good\n");


















}


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
#include<iostream>
#define FOR(i,l,r) for(int i = l; i <= r; i++)
#define ROF(i,r,l) for(int i = r; i >= l; i--)
using namespace std;

const int MAXN = 810;

int s[MAXN][MAXN],map[MAXN][MAXN],n,m,k,l,r;
int qx[MAXN*MAXN],qy[MAXN*MAXN];
int ans = 9999999;

char getChar(){
  char ch = '\n';
  while(ch == '\n' || ch == '\r'){
    ch = getchar();
  }
  return ch;
}

int min(int x, int y){
  return x < y ? x : y;
}

int calc(int x,int y){
  int res = min(x-1,y-1);
  res = min(n-x,res);
  res = min(m-y,res);
  return res;
}

void update(int x,int y){
  ans = min(ans,calc(x,y));
}

void push(int x,int y,int step){
  if(map[x][y] != '.') return;
  map[x][y] = 'S';
  s[x][y] = step;
  r = r + 1;
  qx[r] = x;
  qy[r] = y;
  update(x,y);
}

int main(){
  scanf("%d %d %d\n",&n,&m,&k);
  FOR(i,1,n)
    FOR(j,1,m) {
    map[i][j] = getChar();
    if(map[i][j] == 'S'){
      qx[0] = i; qy[0] = j;
      update(i,j);
    }
  }
  l = 0; r = 0;
  while(l <= r){
    int x = qx[l], y = qy[l];
    int step = s[x][y] + 1;
    if(step > k) break;
    if(x > 1) push(x-1,y,step);
    if(x < n) push(x+1,y,step);
    if(y > 1) push(x,y-1,step);
    if(y < m) push(x,y+1,step);
    l = l + 1;
  }
  ans = ans + k - 1;
  if(calc(qx[0],qy[0]) == 0){
    printf("0");
  }else{
    printf("%d",ans/k + 1);
  }
  return 0;
}


Measured memory_bytes: 10496
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;


signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    vector<vector<ll>> C(3, vector<ll>(3, 0));
    for(ll i=0;i<3;++i)
        for(ll j=0;j<3;++j)cin>>C[i][j];
    bool ans=1;
    if(!(C[0][0]-C[0][1]==C[1][0]-C[1][1]&&C[1][0]-C[1][1]==C[2][0]-C[2][1]))ans=0;
    if(!(C[0][1]-C[0][2]==C[1][1]-C[1][2]&&C[1][1]-C[1][2]==C[2][1]-C[2][2]))ans=0;
    if(!(C[1][0]-C[0][0]==C[1][1]-C[0][1]&&C[1][0]-C[0][0]==C[1][2]-C[0][2]))ans=0;
    if(!(C[2][0]-C[1][0]==C[2][1]-C[1][1]&&C[2][1]-C[1][1]==C[2][2]-C[1][2]))ans=0;
    if(ans)prt("Yes")
    else prt("No")

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * @author yoshizaki
 *
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner= new Scanner(System.in);
        int height = scanner.nextInt();
        int bottom = scanner.nextInt();
        int hypotenuse = scanner.nextInt();
        System.out.println((height * bottom) / 2);
    }
}

Measured memory_bytes: 23124
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;

typedef long long ll;

#define pb push_back
#define mp make_pair
#define x first
#define y second

const ll inf=2147483647;

//

ll read()
{
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		x=x*10+ch-'0';
		ch=getchar();
	}
	return x*f;
}

void print(ll x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
	puts("");
}

int n;
int a[111111];

void ask(int xxx){
	print(xxx);
	fflush(stdout);
	string s;
	getline(cin,s);
	if(s[0]=='M') a[xxx]=0;
	else if(s[0]=='F') a[xxx]=1;
	else{
		exit(0);
	}
}

int main(){
	n=read();
	ask(0);
	ask(n-1);
	
	int l=0,r=n-1;
	while(r-l>1){
		int md=(l+r)>>1;
		ask(md);
		if(a[md]!=a[l]){
			if((md-l)%2==0) r=md;
			else l=md;
		}
		else{
			if((md-l)%2==0) l=md;
			else r=md;
		}
	}
	ask((l+r)>>1);
	
	return 0;
}

Measured memory_bytes: 852
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N;
int dp[2000][2000];
int dp1[2000];
int dp2[2000];
int dp3;
map<pair<int,int>,int> a;
void g(int x, int y, int z) {
	if (z < 0) return;
	if (z <= dp[x][y]) return;
	auto it = a.find({x,y});
	if (it != a.end() && z <= it->second) return;
	a[{x,y}] = z;
}
void f1(int x, int y, int z) {
	g(x, y, dp[z][z]+1);
	g(x, y, dp3);
	for (int i = 0; i < N; ++ i) {
		g(x, i, dp1[i]);
		g(x, i, dp2[i]);
	}
}
void f2(int x, int y) {
	for (int i = 0; i < N; ++ i) {
		g(x, i, dp[i][y]+1);
		g(x, i, dp[y][i]+1);
	}
}
int main() {
	cin >> N;
	vector<int> A(3*N);
	for (auto& x : A) { cin >> x; -- x; }
	for (int i = 0; i < N; ++ i) {
		dp1[i] = dp2[i] = -100;
		for (int j = 0; j < N; ++ j) {
			dp[i][j] = -100;
		}
	}
	dp[A[0]][A[1]] = dp1[A[0]] = dp2[A[1]] = dp3 = 0;
	int res = 0;
	for (int t = 0; t < N-1; ++ t) {
		int x = A[3*t+2];
		int y = A[3*t+3];
		int z = A[3*t+4];
		if (x == y && y == z && z == x) {
			++ res;
		} else {
			f1(x,y,z);
			f1(y,z,x);
			f1(z,x,y);
			if (x == y) f2(z, x);
			if (y == z) f2(x, y);
			if (z == x) f2(y, z);
			for (auto p : a) {
				int x = p.first.first;
				int y = p.first.second;
				int z = p.second;
				dp[x][y] = z;
				dp1[x] = max(dp1[x], z);
				dp2[y] = max(dp2[y], z);
				dp3 = max(dp3, z);
			}
			a.clear();
		}
	}
	{
		int x = A[3*N-1];
		res += max(dp3, dp[x][x]+1);
	}
	cout << res << endl;
}


Measured memory_bytes: 19644
#include<bits/stdc++.h>
using namespace std;
int n,l,r,s,m,g,t;
char str[10];
int get(int x)
{
	int ret=0;
	printf("%d\n",x);
	fflush(stdout);
	scanf("%s",&str);
	if(str[0]=='F') ret=1;
	else if(str[0]=='M') ret=-1;
	return ret;
}
int main()
{
	scanf("%d",&n);
	l=0; r=n;
	s=get(0),t=s;
	if(s==0) return 0;
	while(1)
	{
		m=(l+r)/2;
		g=get(m);
		if(g==0) return 0;
		if(m%2==l%2) 
		{
			if(s==g) l=m,s=g;
			else r=m,t=g;
		}
		else
		{
			if(s!=g) l=m,s=g;
			else r=m,t=g;
		}
	}
	return 0;
}

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

now = 0
all_now = []

for i in range(N):
    now = now+(i+1)
    all_now.append(now)
    if N==now:
        f=1
        break
    elif N<now:
        f=-1
        break
    
all_now = all_now[2:i+1]
now_num = 0
re_num = 3

if f<0:
    print('No')
else:
    print('Yes')
    print(i+2)
    
    ans = [[]]*(i+2)
    
    if N ==1:
        ans[0] = 1
        ans[1] = 1
        print('1 1')
        print('1 1')
    else:
        ans[0] = [1, 2]
        ans[1] = [1, 3]
        ans[2] = [2, 3]
        
        k = 0
        
        for j in range(4, N+1):
            if j>all_now[now_num]:
                k = 0
                re_num = re_num+1
                now_num = now_num+1
                
            ans[k] = ans[k] + [j]
            ans[re_num] = ans[re_num] + [j]
            k = k+1
        
        for j in range(i+2):
            ans2 = [str(len(ans[j]))]
            for k1 in range(len(ans[j])):
                ans2 = ans2 + [str(ans[j][k1])]
            print(' '.join(ans2))
                

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

int main(){
  string S, S1; cin >> S1;
  string T; cin >> T;
  int lenS = S1.size();
  int lenT = T.size();
  if(lenS < lenT) cout << "UNRESTORABLE" << endl;
  else{
    vector<bool> ok2(lenS - lenT + 1, true);
    for(int i = 0; i <= lenS - lenT; i++){
      for(int j = 0; j < lenT; j++){
        if(S1[i + j] != T[j] && S1[i + j] != '?'){
          ok2.at(i) = false;
        }
      }
    }
    bool ok = false;
    for(int i = 0; i <= lenS - lenT; i++){
      if(ok2.at(i))ok = true;
    }
    if(!ok) cout << "UNRESTORABLE" << endl;
    if(ok){
      vector<string> str;
      for(int i = 0; i <= lenS - lenT; i++){
        if(ok2[i]){
          S = S1;
          for(int j = 0; j < lenT; j++){
            S.at(i + j) = T.at(j);
          }
          for(int k = 0; k < lenS; k++){
            if(S.at(k) == '?') S.at(k) = 'a';
          }
          str.push_back(S);
        }
      }
      cout << *min_element(str.begin(), str.end()) << endl;
    }
  }
}   

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e9+7;
using ll = long long;

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

    ll sm = 0;
    for(int i = k; i <= n+1; i++){
       ll mn = 1LL*i*(i-1)/2;
       ll ts =1LL* n*(n+1)/2;
       ll mx = 1LL*(n-i)*(n-i+1)/2;
       sm += (ts-mx) - mn + 1;
       sm%=N;
    }
    cout<<sm%N;
}


Measured memory_bytes: 3568
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>

using namespace std;

int mmap[200][200];
int tot[200][200];

int main()
{
    int n;
    scanf("%d",&n);
    for (int i=0;i<n;++i){
        char ch=getchar();
        while (ch=='\n') ch =getchar();
        long long tmp = 0, tmp2 = 0;
        while (ch!='.' && ch!='\n'){
            tmp = tmp*10 + ch-'0';
            ch = getchar();
        }
        if (ch=='.'){
            ch = getchar();
            while (ch!='\n'){
                ++tmp2;
                tmp = tmp*10 + ch-'0';
                ch = getchar();
            }
        }
        int ind2=0, ind5 = 0;
        ind2 -= tmp2;ind5 -= tmp2;
        while (tmp%2==0){
            ++ind2;tmp/=2;
        }
        while (tmp%5==0){
            ++ind5;tmp/=5;
        }
        mmap[ind2+50][ind5+50]++;
        //printf("%d %d\n",ind2,ind5);
    }
    for (int ind2=50+50;ind2>=0;--ind2)
        for (int ind5=50+10;ind5>=0;--ind5)
            tot[ind2][ind5] = mmap[ind2][ind5] + tot[ind2+1][ind5]+ tot[ind2][ind5+1] - tot[ind2+1][ind5+1];

    long long ans = 0;
    for (int ind2 =50; ind2>-10; --ind2)
        for (int ind5=50; ind5>-10; --ind5)
            if (mmap[ind2+50][ind5+50]>0) {
                if (ind2 >= 0 and ind5 >= 0) {
                    ans += 1LL * mmap[ind2 + 50][ind5 + 50] * (tot[-ind2 + 50][-ind5 + 50] - mmap[ind2 + 50][ind5 + 50]);
                    ans += 1LL * mmap[ind2 + 50][ind5 + 50]*(mmap[ind2 + 50][ind5 + 50]-1);
                }else
                    ans += 1LL * mmap[ind2 + 50][ind5 + 50] * tot[-ind2 + 50][-ind5 + 50];
            }
    printf("%lld\n",ans/2);
}

Measured memory_bytes: 1824
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define Y "Yes"
#define N "No"
#define ll long long
#define pi pair<int, int>
#define ppi pair<pi, pi>
using namespace std;

ll minl(ll a, ll b, ll c) {
	return min(min(a, b), c);
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	ll h, w, ma, mi1, mi2, ans = 1e10;
	cin >> h >> w;
	ll q = h, p = w;
	
	if (h % 3 < 2) ma = h/3;
	else ma = h/3 + 1;
	
	h -= ma;
	ma *= w;
	
	mi1 = h/2 * w;
	mi2 = w/2 * h;
	
	ll a[3];
	a[0] = ma;
	a[1] = mi1;
	a[2] = h*w - mi1;
	sort(a, a + 3);
	ans = min(ans, a[2] - a[0]);
	
	a[0] = ma;
	a[1] = mi2;
	a[2] = h*w - mi2;
	sort(a, a + 3);
	ans = min(ans, a[2] - a[0]);
	
	if (w % 3 < 2) ma = w/3;
	else ma = w/3 + 1;
	
	h = q;
	w = p;
	
	w -= ma;
	ma *= h;
	
	mi1 = h/2 * w;
	mi2 = w/2 * h;
	
	a[0] = ma;
	a[1] = mi1;
	a[2] = h*w - mi1;
	sort(a, a + 3);
	ans = min(ans, a[2] - a[0]);
	
	a[0] = ma;
	a[1] = mi2;
	a[2] = h*w - mi2;
	sort(a, a + 3);
	ans = min(ans, a[2] - a[0]);
	
	cout << ans;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++) cin >> l.at(i);
    sort(l.begin(), l.end(), greater<int>());
    int max = l.at(0), sum = 0;
    for(int i = 1; i < n; i++) sum += l.at(i);
    if (max < sum) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll r;
    cin >> r;
    cout << 3 * r * r << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {
  long long N,Q,a,b,count=0;
  string S;
  cin>>N>>Q>>S;
  long long counter[N];
  counter[0]=0;
  for (long long i=0; i<N-1; i++){
  if(S.at(i)=='A'&&S.at(i+1)=='C'){
  count++;}
  counter[i+1]=count;}
  for (long long i=0; i<Q; i++){
  cin>>a>>b;
  cout<<counter[b-1]-counter[a-1]<<endl;}}


Measured memory_bytes: 1792
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		long h = long.Parse(Console.ReadLine());
		long answer = 0;
    long plusMemo = 1;

    while(true)
    {
      answer += plusMemo;
      plusMemo *= 2;

      h /= 2;
      if(h == 0) break;
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    int na = a.size();
    int nb = b.size();
    int nc = c.size();
    int ka = 0;
    int kb = 0;
    int kc = 0;

    char turn = 'a';
    while(true){
        if(turn == 'a'){
            if(ka == na){
                cout << 'A' << endl;
                return 0;
            }
            turn = a[ka];
            ka++;
        }else if(turn == 'b'){
            if(kb == nb){
                cout << 'B' << endl;
                return 0;
            }
            turn = b[kb];
            kb++;
        }else{
            if(kc == nc){
                cout << 'C' << endl;
                return 0;
            }
            turn = c[kc];
            kc++;
        }
    }
}

Measured memory_bytes: 256
R, C, k = map(int, input().split())
xs = [[0] * C for _ in range(R)]
for _ in range(k):
    r, c, v = map(int, input().split())
    xs[r - 1][c - 1] = v

dp = [[[0] * (C + 1) for _ in range(R + 1)] for _ in range(4)]
for i in range(R):
    for j in range(C):
        for k in range(2, -1, -1):
            dp[k + 1][i][j] = max(dp[k + 1][i][j], dp[k][i][j] + xs[i][j])
        for k in range(4):
            dp[k][i][j + 1] = max(dp[k][i][j + 1], dp[k][i][j])
            dp[0][i + 1][j] = max(dp[0][i + 1][j], dp[k][i][j])
ans = 0
for k in range(4):
    ans = max(ans, dp[k][R - 1][C - 1])
print(ans)


Measured memory_bytes: 428948
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long v = 0;
		for(int i = 0; i < N; i++){
			if(i == 0){
				v = v + K;
			}else{
				v = v * (K - 1);
			}
		}
		System.out.println(v);
	}
}

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

typedef long long ll;

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin>>n;
    double dp[n+1][n+1];
    double P;

    dp[0][0] = 1;
    for (int i=1;i<=n;++i){
        cin>>P;
        for (int j=0;j<=i;++j){
            double s1 = (j>0) ? dp[i-1][j-1]*P : 0;
            double s2 = (i-1>=j) ? dp[i-1][j]*(1-P) : 0;
            dp[i][j] = s1 + s2;
        }
    }

    double ans = 0;
    for (int i=n/2 + 1; i<=n;++i) ans += dp[n][i];
    printf("%.10lf\n", ans);
    return 0;
}



Measured memory_bytes: 70400
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int NMAX = 1e5 + 10;

vector<vector<int>> E(NMAX);
vector<int> d1(NMAX), d2(NMAX);
vector<bool> used(NMAX, false);

int dfs(int node, int depth) {
    d1[node] = depth;
    used[node] = true;

    int md = depth;
    for(auto &e: E[node]) {
        if (used[e]) continue;

        int d = dfs(e, depth + 1);

        md = max(d, md);
    }

    return d2[node] = md;
}

int solve(int node, int step) {
    used[node] = true;
    if (step > d1[node]) return 0;

    int res = d2[node] - 1;
    for(auto &e: E[node]) {
        if (used[e]) continue;

        res = max(res, solve(e, step+1));
    }

    return res;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N, u, v;
    cin >> N >> u >> v;
    u--; v--;

    REP(i, N - 1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        E[a].pb(b);
        E[b].pb(a);
    }

    dfs(v, 0);

    used.assign(N, false);

    print(solve(u, 0));

}


Measured memory_bytes: 14512
from collections import deque


def read():
    H, N = list(map(int, input().strip().split()))
    A = list()
    B = list()
    for i in range(N):
        a, b = list(map(int, input().strip().split()))
        A.append(a)
        B.append(b)
    return H, N, A, B


def solve(H, N, A, B, INF=10**9):
    BMAX = max(B)
    dp = [[INF for i in range(N)] for h in range(H + BMAX + 1)]
    for i in range(0, N):
        dp[0][i] = 0
    for h in range(0, H + BMAX + 1):
        for i in range(N):
            if i == 0:
                if h - A[i] >= 0:
                    dp[h][i] = dp[h - A[i]][i] + B[i]
            else:
                if h - A[i] >= 0:
                    dp[h][i] = min(dp[h][i-1], dp[h - A[i]][i] + B[i])
                else:
                    dp[h][i] = dp[h][i-1]
    min_b = INF
    for h in range(H, H + BMAX + 1):
        for i in range(N):
            min_b = min(min_b, dp[h][i])
    return min_b


if __name__ == "__main__":
    inputs = read()
    print("%s" % solve(*inputs))


Measured memory_bytes: 211848
/*
        Author: Prokash
                CSE48, JU

*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int ara[2005];
int main()
{
    FAST;
    string str;
    cin>>str;
        if((str[2]==str[3]))
        {
            if(str[4]==str[5])
            {
                cout<<"Yes"<<endl;
                return 0;
            }
            else
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
        else
        {
            cout<<"No"<<endl;
                return 0;
        }
        return 0;
}

Measured memory_bytes: 256
function main() {
  var
  total = {
    A : 0,
    B : 0,
    AB: 0,
    O : 0,
  };
  input.forEach(function(line) {
    if(line.trim() === '') return;
    total[line.split(',')[1]]++;
  });
  console.log(total.A);
  console.log(total.B);
  console.log(total.AB);
  console.log(total.O);
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

Measured memory_bytes: 7648
x=int(input())
dig=[]
for i in range(1,4):
  dig.append(x%(10))
  x=x//10

dig.append(x)
count=0

if dig[0]==dig[1]==dig[2] or dig[3]==dig[1]==dig[2]:
  count=1

if count==1:
  print('Yes')
else:
  print('No')




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

int main()
{
  long long n;
  cin >> n;
  long long kMod = 1e9+7;
  long long res = 0;
  long long total = 0;
  cin >> total;
  for (long long i = 1; i < n; i++) {
    long long tmp;
    cin >> tmp;
    res += tmp * total;
    res %= kMod;
    total += tmp;
    total %= kMod;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 3640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)


int main() {
  string s;
  cin >> s;
  int n = s.size();
  
  bool ans = true;
  
  if(s[0]!='A') ans = false;
  repo(i,n) {
    if(s[i]=='A') ans = false;
  }
  
  bool ome = false;
  for (int i = 2; i<=n-2; i++) {
    if(s[i]=='C') ome = true;
  }
  if(ome==false) ans=false;
  
  int count = 0;
  rep(i,n) {
  if(s[i]=='C') count++;
  }
  if(count!=1) ans = false;

  
  rep(i,n) {
    if(s[i]!='A' && s[i]!='C' && s[i]<'a' || 'z'<s[i]) ans=false;
  }
  
  cout << (ans?"AC":"WA") << endl;

}

Measured memory_bytes: 256
import math
a,b,h,m=map(int,input().split())
s=0.5*(h*60+m)
l=6*m
rad=max(s,l)-min(s,l)
if rad>180:
    rad=360-rad
print(math.sqrt((a**2+b**2-2*a*b*math.cos(math.radians(rad)))))

Measured memory_bytes: 9516
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int n;
ll s[100100],segtree[2][410410][2],delayed[2][410410];

void eval(int k, int i, int l, int r){
	if(delayed[k][i]){
		segtree[k][i][0] = segtree[k][i][1]*(r-l);
		if(r-l>1){
			segtree[k][i*2+1][1] = segtree[k][i][1];
			segtree[k][i*2+2][1] = segtree[k][i][1];
			delayed[k][i*2+1] = true;
			delayed[k][i*2+2] = true;
		}
		delayed[k][i] = false;
	}
}

void update(int k, int a, int b, ll v, int i=0, int l=0, int r=n+1){
	eval(k,i,l,r);
	if(b<=l || r<=a){
		return;
	}else if(a<=l && r<=b){
		segtree[k][i][1] = v%MOD;
		delayed[k][i] = true;
		eval(k,i,l,r);
	}else{
		update(k,a,b,v,i*2+1,l,(l+r)/2);
		update(k,a,b,v,i*2+2,(l+r)/2,r);
		segtree[k][i][0] = (segtree[k][i*2+1][0]+segtree[k][i*2+2][0])%MOD;
	}
}

ll query(int k, int a, int b, int i=0, int l=0, int r=n+1){
	eval(k,i,l,r);
	if(b<=l || r<=a){
		return 0ll;
	}else if(a<=l && r<=b){
		return segtree[k][i][0];
	}else{
		return (query(k,a,b,i*2+1,l,(l+r)/2)+query(k,a,b,i*2+2,(l+r)/2,r))%MOD;
	}
}

int main(void){
	int i,x=0,y=0,j;
	ll a,b,tmp,ans;
	cin >> n >> a >> b;
	s[0] = -INFLL;
	for(i=1; i<=n; ++i){
		cin >> s[i];
	}
	update(0,0,1,1ll); update(1,0,1,1ll);
	for(i=1; i<=n; ++i){
		ans = (query(0,0,n)+query(1,0,n))%MOD;
		while(s[i+1]-s[x]>=b){
			++x;
		}
		while(s[i+1]-s[y]>=a){
			++y;
		}
		tmp = query(1,0,y);
		update(1,i,i+1,query(0,0,x));
		update(0,i,i+1,tmp);
		if(s[i+1]-s[i]<a){
			update(0,0,i,0ll);
		}
		if(s[i+1]-s[i]<b){
			update(1,0,i,0ll);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 19584
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

#include <bits/stdc++.h>
using namespace std;

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

int main() {
    int a = read();
    int b = read();
    if (1 <= a && a <= 9 && 1 <= b && b <= 9) {
        cout << a * b;
    } else {
        cout << -1;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    while (true) {
        int H, W;
        cin >> H >> W;
        if (H == 0 && W == 0) break;

        for (auto i = std::size_t(0); i < H; ++i) {
            for (auto j = std::size_t(0); j < W; ++j) {
                cout << "#";
            }
            cout << "\n";
        }
        cout << "\n";
    }
    return 0;
}



Measured memory_bytes: 3080
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//



int main(void) {

    string s; cin >> s;
    if (s[1] == 'R') {
        cout << "ABC" << endl;
    }
    else {
        cout << "ARC" << endl;
    }



    
    
    return 0;
}











Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

struct Edge {
  int to;
  int cost;

  Edge(int a, int b) {
    to = a;
    cost = b;
  }
};

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

  int n;
  cin >> n;

  vector<vector<Edge>> edges(n);
  rep(i, 0, n - 1) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    edges[u].emplace_back(v, w);
    edges[v].emplace_back(u, w);
  }

  vector<ll> G(n, -1);
  G[0] = 0;
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int node = q.front();
    q.pop();
    for (auto edge : edges[node]) {
      if (G[edge.to] != -1)
        continue;
      G[edge.to] = G[node] + edge.cost;
      q.push(edge.to);
    }
  }

  rep(i, 0, n) {
    if (G[i] % 2 == 0)
      cout << 0 << endl;
    else
      cout << 1 << endl;
  }
}


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

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

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

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

	bool ans = false;
	for(int i = 0; i < n; i++) {
		int a; scanf("%d", &a);

		if(a & 1) ans = true;
	}
	if(ans) printf("first\n");
	else printf("second\n");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <cmath>
using namespace std;
int beishu(int cifang,int shu)//就是不喜欢用pow函数。
{
    long long int sum=1;
    for (int i=1;i<=cifang;i++)
        sum*=shu;
    return sum;
}
int weishu(int x)
{
    int num=0;
    while (x)
    {
        num++;
        x/=10;
    }
    return num;
}
int main()
{
    int a,b;
    cin>>a>>b;
    long long int s;
    s=a*beishu(weishu(b),10);//位值原理。
    s+=b;
    int g=sqrt(s);
    if (g*g==s)//判断是否为平方数。
        cout<<"Yes\n";//要换行。
    else
        cout<<"No\n";//要换行。
    return 0;//完美100AC的结束了。
} 

Measured memory_bytes: 256