akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(false);cin.tie(nullptr);
cout << fixed << setprecision(10);
    string x="ACL";
    int y;cin>>y;
    rep(i,y) cout<<x;
    cout<<endl;
}/*
./problem.exe
*/

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

int main() {
    map<int, int> mp;
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        mp[x - 1]++;
        mp[x]++;
        mp[x + 1]++;
    }
    int ans = 0;
    for (pair<int, int> p : mp) ans = max(ans, p.second);
    cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;
using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void ioinit() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); }
inline i64 gcd(i64 a, i64 b) { if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline vi32 plist(i32 n) { vi32 f(n, 1); f[0] = f[1] = 0; repi(i, 2, n) for (int j = i * 2; j < n; j += i) f[j] = 0; return f; }
inline bool isprime(i32 n) { if (n < 2) return 0; for (i32 i = 2; i * i <= n; i++) if (n % i == 0) return 0; return 1; }
template<class T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<class T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<class T> inline bool amax(T &x, T y) { if (x >= y) return 0; x = y; return 1; }
template<class T> inline bool amin(T &x, T y) { if (x <= y) return 0; x = y; return 1; }
template<class T> inline i64 lbi(vector<T> &v, T e) { return lower_bound(all(v), e) - v.begin(); }
template<class T> inline i64 ubi(vector<T> &v, T e) { return upper_bound(all(v), e) - v.begin(); }
template<class T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }

int main() {
  ioinit();
  int a, b, t;
  cin >> a >> b >> t;
  cout << t / a * b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;

typedef long long ll;

vector<int> h;

int f(int l, int r) {
	if (r - l <= 0) return 0;
	if (r - l == 1) return h[l];
	int idx = -1, mi = 1e9;
	for (int i = l; i < r; i++) {
		if (mi > h[i]) {
			mi = h[i];
			idx = i;
		}
	}
	ll ret = h[idx];
	for (int i = l; i < r; i++) h[i] -= ret;
	return ret + f(l, idx) + f(idx + 1, r);
}


int main() {
	int n; cin >> n;
	h = vector<int>(n);
	for (int i = 0; i < n; i++) cin >> h[i];
	cout << f(0, n) << endl;
	return 0;
}


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

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

    bool ok = true;
    if (S.size() % 2 == 1) ok = false;
    for (int i = 0; i < S.size() / 2; i += 2) {
        if (S.substr(i, 2) != "hi") {
            ok = false;
        }
    }

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	char s[200005];
	scanf("%d%s", &n, s);
	int b[200005], w[200005];
	int i;
	b[0] = 0;
	for (i = 0; i < n; i++)
	{
		if (s[i] == '#')
			b[i + 1] = b[i] + 1;
		else
			b[i + 1] = b[i];
	}
	w[n] = 0;
	for (i = n - 1; i >= 0; i--)
	{
		if (s[i] == '#')
			w[i] = w[i + 1];
		else
			w[i] = w[i + 1] + 1;
	}
	int ans = n;
	for (i = 0; i <= n; i++)
		if (ans > b[i] + w[i])
			ans = b[i] + w[i];;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1920
f = lambda x: x if p[x]<0 else f(p[x])
N,M = map(int,input().split())
p = [-1]*N
for _ in range(M):
  A,B = map(lambda x:f(int(x)-1),input().split())
  if A==B: continue
  elif A<B: A,B=B,A
  p[A] += p[B]
  p[B] = A
print(sum(i<0 for i in p)-1)

Measured memory_bytes: 11056
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dx = x2 - x1;
    int dy = y2 - y1;
    cout << x2 - dy << " " << y2 + dx << " " << x1 - dy << " " << y1 + dx;
    return 0;
}


Measured memory_bytes: 256
def read_input():
    return input()

def checker(inp_str):
    flag = 0
    for i in list(inp_str):
        if flag == 0:
            if i == "C":
                flag = 1
        if flag == 1:
            if i == "F":
                flag = 2

    if flag == 2:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    checker(read_input())                   

Measured memory_bytes: 3064
# C
N, M = list(map(int, input().split()))

flag = 0
ans = [0]*N
ans_flag = [0]*N

sc = [list(map(int, input().split())) for _ in range(M)]
for i in range(M):
    s, c = sc[i]
    if ans_flag[s-1] == 1:
        if ans[s-1] != c:
            flag = 1
            break
    ans_flag[s-1] = 1
    ans[s-1] = c

if flag == 1:
    print("-1")
else:
    if N==1:
        for i in ans:
            print(i, end="")

    elif ans[0] == 0 and ans_flag[0]==1:
        print("-1")
    else:
        if ans[0]==0:
            ans[0] = 1
        for i in ans:
            print(i, end="")   


Measured memory_bytes: 3064
from math import ceil

from numpy import cumsum


def solve(string):
    n, h, *ab = map(int, string.split())
    max_a = max(ab[::2])
    cnt = 0
    b = sorted([b for b in ab[1::2] if b > max_a], reverse=True)
    if sum(b) < h:
        cnt = len(b) + ceil((h - sum(b)) / max_a)
    else:
        cnt = (cumsum(b) >= h).argmax() + 1
        """
        for _b in b:
            cnt += 1
            h -= _b
            if h <= 0:
                break
        """
    return str(cnt)


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 36256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll maxn=2e5+1;
void solve()
{
	ll s,w;
	cin>>s>>w;
	if(w>=s) cout<<"unsafe\n";
	else cout<<"safe\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T=1,p=0;
	//cin>>T;
	do
	{
		solve();
		p++;
	}while(p<T);
	return 0;
}



Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main(){
    string s;
    int k;
    cin >> s >> k;
    for(int i = 0; i < k; i++){
        if(s[i] != '1'){
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(n)]
s = c
count = 0

for i in range(n):
    for j in range(m):
        s += a[i][j] * b[j]
    if s > 0:
        count += 1
    s = c
    
print(count)
        


Measured memory_bytes: 3060
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
//cout << setprecision(123);
//a=atoi(S.c_str());
//S=to_string(a);
int main(){
  int a,b;
  cin>>a>>b;
  cout<<max(0,a-2*b)<<endl;
}

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

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

int main()
{
	ll N, K; cin >> N >> K;
	ll C = K;

	rep(i, 1, N) {
		C *= (K - 1);
	}
	cout << C << endl;
	return 0;
}

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

int main() {

    int arr[5], k;
    for (int i=0; i<5; i++) {
        cin >> arr[i];
    }
    cin >> k;
    sort(arr, arr+5);
    if (abs(arr[4] - arr[0]) > k) {
        cout << ":(";
    }
    else {
        cout << "Yay!";
    }

}

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

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char smax(A &a, const B &b) {return a < b ? a = b, 1 : 0;}
template<typename A, typename B> inline char smin(A &a, const B &b) {return b < a ? a = b, 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I> inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

const int N = 200000 + 7;
const int M = 1e6 + 7;
const int P = 998244353;

int n, m, sum;
int a[N], b[M], f[M];

inline int smod(int x) { return x >= P ? x - P : x; }
inline void sadd(int &x, const int &y) { x += y; x >= P ? x -= P : x; }
inline int fpow(int x, int y) {
	int ans = 1;
	for (; y; y >>= 1, x = (ll)x * x % P) if (y & 1) ans = (ll)ans * x % P;
	return ans;
}

inline void work() {
	int ans = 0;
	for (int i = m; i; --i) {
		int ss = 0;
		for (int j = i; j <= m; j += i) sadd(ss, (ll)j * b[j] % P);
		f[i] = (ll)ss * ss % P;
		for (int j = i << 1; j <= m; j += i) sadd(f[i], P - f[j]);
		sadd(ans, (ll)f[i] * fpow(i, P - 2) % P);
//		dbg("f[%d] = %d\n", i, f[i]);
	}
	ans = smod(ans + P - sum);
	ans = (ll)ans * fpow(2, P - 2) % P;
	printf("%d\n", ans);
}

inline void init() {
	read(n);
	for (int i = 1; i <= n; ++i) read(a[i]), b[a[i]]++, smax(m, a[i]), sadd(sum, a[i]);
}

int main() {
#ifdef hzhkk
//	freopen("hkk.in", "r", stdin);
#endif
	init();
	work();
	fclose(stdin), fclose(stdout);
	return 0;
}

Measured memory_bytes: 8832
#include<stdio.h>
void trace(int A[],int N[]){
	int i;
	for (i = 0;i < N;i++){
		if(i>0){
			printf(" ");
		}
		printf("%d",A[i]);
	}
	printf("\n");
}

void IS(int A[],int N[]){
	int j,i,v;
	for (i = 1;i< N;i++){
		v = A[i];
		j = i - 1;
		while( j >= 0 && A[j] > v){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
		trace(A,N);
	}
}

int main(void){
	int N,i;
	int A[100];
	scanf("%d",&N);
	for (i = 0;i < N;i++){
		scanf("%d",&A[i]);
	}
	
	trace(A,N);
	IS(A,N);
	
	return 0;
}


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

#define N 100005

vector<pair<int,int> >edge[N];
int color[N], visited[N], degree[N];

void dfs(int v, int parent_color) {
	visited[v] = 1;
	
	int current_color = 1;
	if(current_color == parent_color)
		current_color++;

	for(int i=0; i<edge[v].size(); i++) {
		int x = edge[v][i].first, e = edge[v][i].second;
		if(visited[x])
			continue;
		color[e] = current_color;
		dfs(x, current_color);
		current_color++;
		if(current_color == parent_color)
			current_color++;
	}
}

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

	memset(degree, 0, sizeof(degree));
	for(int i=0; i<n-1; i++) {
		int a, b;
		cin>>a>>b;
		a--;
		b--;
		edge[a].push_back(make_pair(b, i));
		edge[b].push_back(make_pair(a, i));
		degree[a]++;
		degree[b]++;
	}

	int root = 0 ;
	for(int i=1; i<n; i++) {
		if(degree[i] > degree[root])
			root = i;
	}

	memset(color, -1, sizeof(color));
	memset(visited, 0, sizeof(visited));
	dfs(root, -1);

	cout<<degree[root]<<endl;
	for(int i=0; i<n-1; i++) {
		cout<<color[i]<<endl;
	}


	return 0;
}

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

int main() {
  int r;
  cin >> r;
  if (r < 1200) {
    cout << "ABC" << endl;
  } else if(r<2800) {
    cout << "ARC" << endl;
  } else {
    cout << "AGC" << endl;
  }
  return 0;
}

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

int main()
{
    int K, A, B;
    cin >> K >> A >> B;

    if (A <= B / K * K)
    {
        cout << "OK" << endl;
    }
    else
    {
        cout << "NG" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
//header files

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

int main()
{
	long long n,count=0;
	cin>>n;
	long long i = 1;
	for(;i<n;i++)
	{
		if(n%i==0)
			count+=(n/i)-1;
		else
			count+=(n/i);
	}
	//count = 13/2;
	cout<<count;
	return 0;
}

Measured memory_bytes: 3632
import heapq

N, M = map(int, input().split())
A = [-int(A) for A in input().split()]
heapq.heapify(A)

for x in range(M):
  most = -heapq.heappop(A)
  most //= 2
  heapq.heappush(A, -most)

print(-sum(A))


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

namespace AtCoder.Contest.A
{
	static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			var cin = new Scanner();

			int a = cin.NextInt() * 60 + cin.NextInt();
			int b = cin.NextInt() * 60 + cin.NextInt();
			int k = cin.NextInt();
			Console.WriteLine(Math.Max(0, b - a - k));

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 27384
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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()
{
    int n; cin >> n;
    vll a(n), b(n), c(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) c[i] = a[i] - b[i];
    ll asum = 0, bsum = 0;
    rep(i, n) asum += a[i];
    rep(i, n) bsum += b[i];
    
    if(asum < bsum) {pr(-1); return 0;}

    ll small_sum=0, small_cnt=0;
    rep(i, n) if(b[i] > a[i]) {small_sum += b[i] - a[i]; small_cnt++;}
    if(small_cnt==0) {pr(0); return 0;}
    sort(c.rbegin(), c.rend());

    ll large_sum=0;
    int ans = 0;
    rep(i, n){
        large_sum += c[i];
        if(large_sum >= small_sum){
            ans = i+1;
            break;
        }
    }

    pr(ans+small_cnt);
    return 0;}

Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
string s;int len;
int main()
{
    cin>>s;len=s.length();
    for(int i=2;i<len;i++)if(s[i]==s[i-1]&&s[i]==s[i-2]){cout<<"Yes"<<endl;return 0;}
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<iterator>
#include<iomanip>
#include<string>
using namespace std;

int main()
{
    long long int a,b,k;
    cin>>a>>b>>k;
    long long int c=a+b-k;
    if (a+b<k)      {cout<<"0 0";}
    else if (c>b)   {cout<<c-b<<" "<<b;}
    else            {cout<<"0 "<<c;}
    return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
int N;
string S;
string animal;  // S:羊 W:狼 とした動物列を文字列として表現
bool same(int index) {
    if((animal[index] == 'S' and S[index] == 'o')
     or (animal[index] == 'W' and S[index] == 'x')) return true; // 両隣は同じ
    else return false;  // 両隣は異なる
}
bool decide_sheep_or_wolf() {
    for(int i = 1; i < N-1; i++) {
        if(same(i)) {
            animal += animal[i-1];
        }
        else {
            animal += (animal[i-1] == 'S' ? 'W' : 'S'); // 逆
        }
    }

    // 矛盾
    if(same(0) != (animal[N-1] == animal[1])) return false;
    if(same(N-1) != (animal[N-2] == animal[0])) return false;
    return true;
}
int main() {
    cin >> N;
    cin >> S;
    // 初めの2つの動物を決めるとoxの情報から芋づる式に決まっていく
    // 矛盾が無いかをそれぞれについて調べてなければ終わり
    // 答えがなければ-1
    vector<string> a = { "SS", "SW", "WS", "WW" };
    for(int i = 0; i < 4; i++) {
        animal = a[i];
        if(decide_sheep_or_wolf()) {
            cout << animal << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 776
n, x = map(int, raw_input().split())
a = map(int, raw_input().split())
ans = 0
for i in xrange(n - 1):
    o = a[i] + a[i + 1] - x
    if o > 0:
        ans += o
        a[i + 1] -= min(o, a[i + 1])

print ans


Measured memory_bytes: 11316
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main()
{
    string T;
    cin >> T;
    for (size_t i=0; i<T.size(); i++) {
        if (T[i] == '?') {
            T[i] = 'D';
        }
    }
    cout << T << endl;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
	string a,b;
    int i,j,c=0;
	cin>>a>>b;
	for(i=a.length()-1,j=0;i>=0,j<=a.length()-1;i--,j++)
	{
		if(a[j]==b[i])
		{
			c++;
		}
		else
		break;
	}
	if(c==a.length())
	printf("YES\n");
	else
	{
		printf("NO\n");
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 300005;
#define _for(i,a,b) for(int i=a;i<=b;i++)
char s[maxn];
int n,a[maxn],b[maxn];
int main(int argc, char const *argv[])
{
    cin>>n;
    _for(i,1,n)cin>>s[i];
    _for(i,1,n)
    {
        if(s[i]=='W')a[i]=a[i-1]+1;
        else a[i]=a[i-1];
    }
    for(int i=n;i>=1;i--)
    {
        if(s[i]=='E')b[i]=b[i+1]+1;
        else b[i]=b[i+1];
    }
    int ans = maxn+7;
    _for(i,1,n)ans=min(ans,a[i]+b[i]-1);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2944
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
int main(){
    ll n;cin>>n;
    map<ll,int>map;
    int ans=0;
    ll m;rep(i,n){
        cin>>m;
        map[m-1]++;
        map[m]++;
        map[m+1]++;
    }
    for(auto p:map){
        ans=max(ans,p.second);
    }
    cout<<ans<<endl;
    
}

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

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

using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    ll ans = 0;
    REP(i, N)
    {
        int a;
        cin >> a;
        ans += a - 1;
    }

    cout << ans << endl;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

struct Segtree {
  vector<ll> v;
  int size;

  Segtree(vector<ll>& moto) {
    size = 1;
    while (size < moto.size()) size *= 2;
    v.resize(size * 2 - 1);
    for (int i = 0; i < moto.size(); i++) {
      v[i + size - 1] = moto[i];
    }
    for (int i = size - 2; i >= 0; i--) {
      v[i] = max(v[i * 2 + 1], v[i * 2 + 2]);
    }
  }

  void change(int now, ll x) {
    now += size - 1;  // 最下段に移動する
    v[now] = max(v[now], x);
    while (now > 0) {
      int p = (now - 1) / 2;
      v[p] = max(v[p], v[now]);
      now = p;
    }
  }

  ll get(int l, int r, int n = 0, int a = 0, int b = 0) {
    if (n == 0) b = size;
    if (l <= a && b <= r)
      return v[n];
    else if (r <= a || b <= l)
      return 0;
    else
      return max(get(l, r, 2 * n + 1, a, (a + b) / 2), get(l, r, 2 * n + 2, (a + b) / 2, b));
  }

  ll operator[](int i) {
    return v[i + (size - 1)];
  }
};

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<ll> h(n), v(n);
  for (int i = 0; i < n; i++) cin >> h[i], h[i]--;
  for (int i = 0; i < n; i++) cin >> v[i];

  vector<ll> dp(n, 0);  // 列の右端がiのときの、総和の最大値
  Segtree seg(dp);
  for (int i = 0; i < n; i++) {
    dp[h[i]] = seg.get(0, h[i]) + v[i];
    // cout << seg.get(0, h[i]) << endl;
    // cout << "h[i]=" << h[i] << " dp[h[i]]=" << dp[h[i]] << endl;
    seg.change(h[i], dp[h[i]]);
  }

  // for (int i = 0; i < n; i++) cout << seg[i] << endl;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, seg[i]);
  }
  cout << ans << endl;
}


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

using namespace std;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i) cin >> a[i];
	sort(a.begin(), a.end());
	for(int i = 0; i < n - 1; ++i){
		if(a[i] == a[i+1]){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main{

	public static void main(String[] args) throws 

java.io.IOException {
		int x,h,m,s;
		Scanner in = new Scanner(System.in);
		x = in.nextInt();
		h = x / 3600;
		x = x % 3600;
		m = x / 60;
		s = x % 60;
		System.out.println(h + ":" + m + ":" + s);
	}
}

Measured memory_bytes: 17328
N, M = map(int, input().split())
H = list(map(int,input().split()))
Road = [sorted(list(map(int, input().split()))) for _ in range(M)]
num = N
Mem = [0 for _ in range(N)]
for j in range(M):
  if H[Road[j][0]-1] > H[Road[j][1]-1] and Mem[Road[j][1]-1] != 1:
    num -= 1
    Mem[Road[j][1]-1] = 1
  elif H[Road[j][1]-1] > H[Road[j][0]-1] and Mem[Road[j][0]-1] != 1:
    num -= 1
    Mem[Road[j][0]-1] = 1
  elif H[Road[j][1]-1] == H[Road[j][0]-1]:
    if Mem[Road[j][0]-1] != 1 and Mem[Road[j][1]-1] != 1:
      num -= 2
      Mem[Road[j][0]-1] = 1
      Mem[Road[j][1]-1] = 1
    elif Mem[Road[j][0]-1] == 1 and Mem[Road[j][1]-1] == 1:
      continue
    else:
      num -= 1
      Mem[Road[j][0]-1] = 1
      Mem[Road[j][1]-1] = 1
print(num)

Measured memory_bytes: 97488
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

    for h in range(H):
        for w in range(W):
            if h == 0 or h == H -1 or w == 0 or w == W -1:
                print('#', end='')
            else:
                print('.', end='')

        print()

    print()

Measured memory_bytes: 9028
#include <iostream>
#include <vector>
#include <limits>

using namespace std;

int calc_score(int D, const vector<int>& c, const vector<vector<int>>& s, const vector<int>& last, int d, int t)
{
	int v = s[d][t];
	for (int i = 0; i < 26; ++i) {
		if (i != t) {
			v -= c[i] * (d + 1 - last[i]);
		}
	}
	return v;
}

int main()
{
	int D;
	cin >> D;
	vector<int> c(26);
	for (auto& x : c) {
		cin >> x;
	}
	vector<vector<int>> s(D, vector<int>(26));
	for (auto& v : s) {
		for (auto& x : v) {
			cin >> x;
		}
	}

	vector<int> last(26, 0);

	vector<int> t(D, -1);

	int v = 0;
	for (int d = 0; d < D; ++d) {
		int w_max = numeric_limits<int>::min();
		for (int k = 0; k < 26; ++k) {
			int score = calc_score(D, c, s, last, d, k);
			if (w_max < score) {
				w_max = score;
				t[d] = k;
			}
		}
		v += calc_score(D, c, s, last, d, t[d]);
		last[t[d]] = d + 1;
	}

	for (auto x : t) {
		cout << x + 1 << endl;
	}
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a.rbegin(), a.rend());
    int alice = 0;
    int bob = 0;
    for (int j = 0; j < n; ++j) {
        if (j % 2) bob += a[j];
        else alice += a[j];
    }    
    cout << alice - bob << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  
  int ans = (b-1+a-1-1)/(a-1);
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>

using namespace std;

int n;
string s;
bool cs[1000];

int main(){
    cin>>s;
    for(int i=0;i<s.length();i++){
        cs[int(s[i])]=true;
    }
    cout<<(cs[int('a')] and cs[int('b')] and cs[int('c')] ? "Yes":"No")<<endl;
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmin(T& a, U b){T bb = b;if(a>bb){a = bb;return 1;}return 0;}
template<class T, class U> inline bool chmax(T& a, U b){T bb = b;if(a<bb){a = bb;return 1;}return 0;}
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
#define double long double
#define PI 3.141592653589793
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1e16;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

vector<int> divisor(int n){
  vector<int> ret;
  for(int i = 1;i*i <= n;i++){
    if(n%i == 0){
      ret.push_back(i);
      if(i*i != n)ret.push_back(n/i);
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

/*
void dijkstra(){
  priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;pq.push(make_pair(0,0));
  rep(i,110000)d[i] = INF;d[0] = 0;
  while(!pq.empty()){
    pair<int,int> from = pq.top();pq.pop();
    int fromV = from.second, fromC = from.first;
    if(d[fromV] < fromC)continue;
    rep(i,g[fromV].size()){
      int to = g[fromV][i];
      if(d[to] <= fromC+costs[to])continue;
      d[to] = fromC+costs[to];
      pq.push(make_pair(d[to], to));
    }
    //cout << fromV << " " << fromC << endl;
  }
}*/

const int MAX = 10000000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
  int x,y;cin>>x>>y;
  COMinit();
  if((2*x-y)%3 != 0 || (2*y-x)%3 != 0){
    cout << 0 << endl;return 0;
  }
  int a = (2*x-y)/3, b = (2*y-x)/3;
  cout << COM(a+b, a) << endl;
}



Measured memory_bytes: 234624
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */

public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt(),y=sc.nextInt(),z=sc.nextInt();
		System.out.println(z+" "+x+" "+y);
	}
}

Measured memory_bytes: 21844
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();

        System.out.println(Math.min(A, B) + Math.min(C, D));
    }
}


Measured memory_bytes: 21844
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

int main(void)
{
	int a, b, h, m;
	while(scanf("%d%d%d%d", &a, &b, &h, &m)==4)
	{
		double at=2.0*PI*(60*h+m)/720;
		double bt=2.0*PI*m/60;

		double ax= a*sin(at);
		double ay=-a*cos(at);
		double bx= b*sin(bt);
		double by=-b*cos(bt);

		double d=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));

		printf("%.10f\n", d);
	}
	return 0;
}


Measured memory_bytes: 2536
#include <cstdio>
#include <algorithm>

int main()
{
	long long a, b, c;
	scanf("%lld%lld%lld", &a, &b, &c);
	if (c - a - b >= 0)
	{
		long long lhs = 4 * a * b;
		long long rhs = (c - a - b) * (c - a - b);
		puts(lhs < rhs ? "Yes" : "No");
	}
	else
	{
		puts("No");
	}
	return 0;
}


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

using namespace std;

int red[100010];
int white[100010];
bool f[100010];
int cnt[100010];

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  red[0] = 1;
  white[0] = 0;
  for (int i = 1; i < n; ++i) {
    red[i] = 0;
    white[i] = 1;
  }
  memset(f, false, sizeof f);
  for (int i = 0; i < n; ++i) {
    cnt[i] = 1;
  }
  bool found = false;
  while (m--) {
    int from, to;
    scanf("%d %d", &from, &to);
    --from; --to;
    --cnt[from];
    ++cnt[to];
    if (!found) {
      if ((red[from] && white[to]) || (red[to] && white[from])) {
        f[to] = found = true;
      } else {
        if (red[from]) {
          red[from] = 0;
          red[to] = 1;
        } else {
          --white[from];
          ++white[to];
        }
      }
    } else {
      if (f[from]) {
        if (cnt[from] == 0) {
          f[from] = false;
        }
        f[to] = true;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (f[i]) {
      ++ans;
    }
  }
  if (ans == 0) ans = 1;
  printf("%d\n", ans);
  return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

vector< vector< int > > grid_bfs(vector< string > &s, int sx, int sy) {
  const int vx[] = {0, 1, 0, -1}, vy[] = {1, 0, -1, 0};
  vector< vector< int > > min_cost(s.size(), vector< int >(s[0].size(), -1));
  queue< pair< int, int > > que;
  for(int i = 0; i < (int)s.size(); i++) {
    for(int j = 0; j < (int)s[i].size(); j++) {
      if(i == sx && j == sy) {
        que.emplace(i, j);
        min_cost[i][j] = 0;
      }
    }
  }
  while(!que.empty()) {
    auto p = que.front();
    que.pop();
    for(int i = 0; i < 4; i++) {
      int nx = p.first + vx[i], ny = p.second + vy[i];
      if(nx < 0 || ny < 0 || ny >= (int)s[0].size() || nx >= (int)s.size()) continue;
      if(min_cost[nx][ny] != -1) continue;
      if(s[nx][ny] == '#') continue;
      min_cost[nx][ny] = min_cost[p.first][p.second] + 1;
      que.emplace(nx, ny);
    }
  }
  return min_cost;
}

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

    ll H, W;
    cin >> H >> W;
    vector<string> S(H);
    REP(i, H){
    	cin >> S[i];
    }

    int res = 0;
    REP(sx, H){
    	REP(sy, W){
    		if(S[sx][sy]=='#') continue;
    		auto tmp = grid_bfs(S, sx, sy);
    		/*
    		cout << tmp << endl;
    		cout << endl;
    		*/
    		REP(tx, H){
    			REP(ty, W){
    				res = max(res, tmp[tx][ty]);
    			}
    		}
    	}
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
inline void fastio(){cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15);}
ll gcd(ll a,ll b){ll c=max(a,b);ll d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}

template<int N, typename T, T M>
struct ModFact {
    T fact[N+1];
    T ifact[N+1];
    constexpr ModFact() : fact(), ifact() {
        fact[0] = 1;
        for (int i=0; i<N; ++i)
            fact[i+1] = (fact[i]*(i+1))%M;
        ifact[N] = power(fact[N], M-2);
        for (int i=N-1; i >= 0; --i)
            ifact[i] = (ifact[i+1]*(i+1))%M;
    }
    constexpr T power(T a, T b) {
        T r = 1;
        while (b>0) {
            if((b&1)!=0) r = (r*a)%M;
            a = (a*a)%M;
            b >>= 1;
        }
        return r;
    }
    constexpr T comb(T n, T r) {
        return (((fact[n]*ifact[r])%M)*ifact[n-r])%M;
    }
};
 
ModFact<100000, ll, MOD> fact;

ll N, M, ans = 1;
ll th = 1LL<<45;
ll cnt = 1;
char S[200000];

int main() {
    scanf("%lld\n", &N);
    M = N << 1;
    fread_unlocked(S, 1, M, stdin);
    if(S[0] == 'B' && S[M-1] == 'B') {
        bool f = false;
        for(ll i = 1; i < M; i++) {
            if(S[i] == S[i-1]) f ^= true;
            if(f) {
                ans *= (cnt << 1) - i;
                if(ans > th) ans %= MOD;
            }
            else if(++cnt > N) break;
        }
        if(cnt != N) ans = 0;
        else ans = ((ans % MOD) * fact.fact[N]) % MOD;
    } else ans = 0;
    printf("%lld\n", ans);
	return 0;
}


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

int main(void){
    
    int n, k;
    cin >> n >> k;
    
    n -= k;
    if(n <= 0) {
        cout << 1 << endl;
        return 0;
    }
    
    int count = 1;
    while(n > 0) {
        n -= (k-1);
        count++;
    }

    cout << count << endl;
    
    return 0;
}


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

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  if (n%2 == 1) ans = 0;
  else {
    for (ll i = 1; i < 100; i++) {
      ll five = 1;
      for (int j = 0; j < i; j++) {
        five *= 5;
      }
      if (n/(five*2) < 1) break;
      ans += n/(five*2);
    }
  }
  cout << ans << endl;
}

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

#define REP(i, n) for(int64_t i = 0; i < n; i++)
#define REPR(i, n) for(int64_t i = n; i >= 0; i--)
#define FOR(i, m, n) for(int64_t i = m; i < n; i++)
#define FORR(i, m, n) for(int64_t i = m; i >= n; i--)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
template<class T>
inline bool chmax(T &a, T b) {if(a < b) {a = b;return true;}return false;}
template<class T>
inline bool chmin(T &a, T b) {if(a > b) {a = b;return true;}return false;}
const ll INF= 1ll << 60;
const ll MOD = 1000000007;
double EPS = 1e-10;
//----------------------------------------------------------

ll N, A, B;

int main(){
    cin >> N >> A >> B;
    if((B-A)%2==0){cout << B-(A+B)/2 << endl;}
    else
    {
        if(A-1 <= N-B)
            cout << A + (B - A) - (1+B-A)/2 << endl;
        else
        {
            cout << N-B+1 + N - (N+A+N-B+1)/2 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math; 

public class Main 
{
	public static void main(String[] args)
	{
		Scanner input = new Scanner(System.in);
		double h= input.nextDouble();
		double a = input.nextDouble();
		int res = (int)Math.ceil(h/a);
		 
		System.out.println(res);
		
	}

}


Measured memory_bytes: 24404
#include<iostream>
#include<vector>
#include<string>

std::string Caesar(std::string str, int tranceNum )
{
	for(size_t i=0; i<str.length(); ++i)
	{
		if('a'<=str[i] && str[i]<='z')
		{
			int chNum = 0;
	
			chNum = str[i];

			chNum += tranceNum;

			chNum = (chNum-97)%26+97;
	
			str[i] = chNum;	
		
		}
	}

	return str;
}

int main()
{
	std::string sentence;

	while(std::getline(std::cin,sentence))
	{
		bool flg=0;

		
		for(;;)
		{
			sentence=Caesar(sentence,1);

			std::string checkword = ""; 

			size_t i=0;

			for( ; i<sentence.size() && flg==0; ++i)
			{
				switch(sentence[i])
				{
				case 't': case 'h': case 'i': case 's': case 'a': case 'e':
					checkword+=sentence[i];
					break;
				default :
					checkword = "";
					break;
				}

				if(checkword=="this" || checkword=="the" || checkword=="that")
				{
					break;
				}
			}
			if(i!=sentence.size())
			{
				std::cout << sentence << '\n';

				break;
			}
		}
	}
}

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

int main(){ 
  const int Nbits= 55555;
  int N;
  cin >> N;

  bitset<Nbits> primes; // primes.test(i): iが素数かどうか
  primes.set(); primes.reset(0); primes.reset(1);
  int div= 2;
  while(div*div < Nbits){
    if(primes.test(div)){
      for(int i=2*div; i< Nbits; i+= div){
        primes.reset(i);
      }
    }
    div++;
  }

  bitset<Nbits> mask; // 5n+k型のビットマスク
  int shift= 1;
  for(int i=shift; i<Nbits; i+=5){ mask.set(i); }

  bitset<Nbits> ans;
  ans.set(2);
  while(true){
    bitset<Nbits> buf= primes & mask;
    if(buf.count() >= N-1){
      ans |= buf;
      break;
    }

    mask << 1;
    shift++;
  }

  cout << 2;
  int p= shift; int cnt_out= 1;
  while(cnt_out < N){
    if(ans.test(p)){
      cout <<" "<< p;
      cnt_out++;
    }
    p+= 10;
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 5;
const int INF = 1e18;

int n;
vector<int> a(N);

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int ans = 1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if (a[i] == 0)
		{
			cout << 0;
			return 0;
		}
	}
	for (int i = 0; i < n; i++)
	{
		if (ans <= (INF / a[i]))
			ans *= a[i];
		else
		{
			cout << -1;
			return 0;
		}
	}
	cout << ans;
	return 0;
}
//10-09-2020 18:18:29

Measured memory_bytes: 3864
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <ctype.h>
int main()
{
    
    int N,K;
    char S[50];
    std::cin >> N >> K;
    for(int i=0; i<N; i++){
    std::cin >> S[i];
    }
    S[K-1]=(char)tolower(S[K-1]);
    for(int i=0; i<N; i++){
    std::cout << S[i];
    }
  std::cout <<std::endl;
    return 0;
}

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

const long long mod=1000000007LL;

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int c[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>c[i];
	}
	long long ans[n+5],memo[200005]={};
	ans[0]=1LL;
	memo[c[0]]=1LL;
	for (int i = 1; i < n; ++i)
	{
		ans[i]=ans[i-1];
		if (c[i]!=c[i-1])
		{
			ans[i]+=memo[c[i]];
		}
		ans[i]%=mod;
		memo[c[i]]=ans[i];
	}
	cout<<ans[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vl A(N);
  rep(i,N) {
    cin >> A[i];
  }
  sort(rng(A));
  if(A[0]==0) {
    cout << 0 << endl;
    return 0;
  }
  rep(i,N) {
    if(A[i]>1000000000000000000ll) {
      cout << -1 << endl;
      return 0;
    }
  }
  __int128_t acc=1;
  rep(i,N) {
    __int128_t tmp = acc * A[i];
    if(tmp/A[i]==acc) {
      acc=tmp;
    } else {
      cout << -1 << endl;
      return 0;
    }
    if(acc>1000000000000000000ll) {
      cout << -1 << endl;
      return 0;
    }
  }
  if(acc>1000000000000000000ll) {
    cout << -1 << endl;
  } else {
    cout << (ll)acc << endl;
  }
  return 0;
}

Measured memory_bytes: 4040
import java.util.Scanner;

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

			int n = scan.nextInt();
			int[] array = new int[n];
			for(int i=0; i<n; i++) {
				array[i] = scan.nextInt();
			}
			
			int dice = 0;
			int counter = 0; 
			
			for(int i=0; i<array.length; i++) {

				if(array[i] == 1) {
					counter++;
				}else {
					dice = Math.max(dice, counter);
					counter = 0;
				}
			}
			dice = Math.max(dice, counter);
			System.out.println(dice+1);
		}
	}
}


Measured memory_bytes: 26380
a=[]
i=0
s=0
def judge(n,m):
    if n<=m:
        return str(n)+" "+str(m)
    else:
        return str(m)+" "+str(n)

while 1:
    l= input().split()
    n=int(l[0])
    m=int(l[1])
    if n==0 and m==0:
        break
    else:
        a.append(judge(n,m))
        i=i+1

while s<i:
    print(a[s])
    s=s+1


Measured memory_bytes: 5852
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    ll n;
    cin >> n;

    ll p[n];
    rep(i, 0, n){
        cin >> p[i];
    }

    ll mi = 100000000;
    ll count = 0;
    rep(i, 0, n){
        if(p[i] <= mi){
            count++;
            mi = p[i];
        }
    }

    cout << count << endl;
    return 0;
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    bool ans;
    cin >> ans;
    cout << !ans << '\n';
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
inline constexpr ll Inf = (1ULL << 62) -1;

vector<set<int>> e;
vector<bool> v;

void search(int x, int& c) {
    if (v[x])
        return;
    v[x] = true;
    ++c;
    for (auto t : e[x]) {
        search(t, c);
    }
}

int main() {
    ll N, M;
    cin >> N >> M;
    e.resize(N);
    v.resize(N);
    rep(i,M) {
        int a,b;
        cin >> a >> b;
        --a;--b;
        e[a].insert(b);
        e[b].insert(a);
    }
    int ans = 1;
    rep(i,N) {
        int c=0;
        search(i, c);
        ans = max(ans, c);
    }
    cout << ans << endl;
}


Measured memory_bytes: 37512
N = int(input())
A = list(map(int, input().split()))

kane=1000
kabu=0
for i in range(N-1):
    #print(kane,kabu)
    
    if A[i]<A[i+1]:
        kane=kabu*A[i]+kane
        kabu=kane//A[i]
        kane=kane-kabu*A[i]
    else:
        kane=kabu*A[i]+kane
        kabu=0
        
print(kane+kabu*A[N-1])

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD;
#define MODSUB(SUB_X,SUB_Y)  (SUB_X-SUB_Y)+MOD)%MOD;
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD;
#define LCM(LCM_X,LCM_Y) (LCM_X*LCM_Y)/__gcd(LCM_X,LCM_Y);
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};

int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);

    int cnt=0,a,b,ans=0;
    cin>>a>>b;
    cnt=1;
    ans=0;
    while(cnt<b)
    {
        cnt+=a;
        cnt--;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3616