akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
	int a, b, c;
	cin>>a>>b>>c;
	if(b - a == c - b) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

template<typename T>
T eular_totient(T n) {
	T ret = n;
	for(T i = 2; i * i <= n; ++i) {
		if( n % i == 0 ) {
			ret = ret / i * (i - 1);
		}
		
		while( n % i == 0 ) {
			n /= i;
		}
	}
	
	if( n != 1 ) ret = ret / n * (n - 1);
	
	return ret;
}

int main(void) {
	int n;
	cin >> n;
	
	cout << eular_totient(n) << endl;
	
	return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}


int main(){
  int N;
  cin >> N;
  vector<int> coin;
  coin.push_back(1);
  coin.push_back(0);
  for(int i = 1; pow(6,i) <= 100000; i++) coin.push_back((int)pow(6,i));
  for(int i = 1; pow(9,i) <= 100000; i++) coin.push_back((int)pow(9,i));
  sort(all(coin));
  vector<int> dp(100100,(int)1e9);
  dp[0] = 0;

  FOR(i,1,coin.size()){
    for(int j = 0; j + coin[i] <= N; j++){
      dp[j+coin[i]] = min(dp[j+coin[i]],dp[j]+1);
    }
  }
  cout << dp[N] << endl;
  return 0;
}


Measured memory_bytes: 640
import queue

n = int(input())

e = []
f = [{} for i in range(n)]

for i in range(n-1):
    a,b = map(int, input().split())
    a-=1
    b-=1
    e.append([a,b])
    f[a][b]=0
    f[b][a]=0

k = 0
for i in range(n-1):
    k = max(k,len(f[i]))

q = queue.Queue()
q.put(0)
used = [[0] for i in range(n)]

while not q.empty():
    p = q.get()
    for key,c in f[p].items():
        if c == 0:
            if used[p][-1]<k:
                col = used[p][-1]+1
            else:
                col = 1
            f[p][key] = col
            f[key][p] = col
            used[p].append(col)
            used[key].append(col)
            q.put(key)

print(k)
for a,b in e:
    print(max(f[a][b],f[b][a]))












Measured memory_bytes: 122012
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
    if (a < b) return gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    int K, A, B;
    cin >> K >> A >> B;
    for (int i = A; i < B + 1; i++) {
        if (i % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

int n; cin >> n;
cout << n*(n+1)/2 << endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;

using namespace std;

int main() 
{
    string s;
    int ans = 0;

    cin >> s;
    irep(i, 3) {
        if(s[i] == '1') { ans++; }
    }
    cout << ans << endl;
    return 0;
}
    



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <unordered_map>
//#include <bits/stdc++.h>
#include <cassert>
#include <map>
#include <bitset>
using namespace std;

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;



const int maxn = 1e5+1;
int n, a[maxn], l;

int main()
{
  scanf("%d %d", &n, &l);
  for (int i = 0; i < n; ++i)
    {
      scanf("%d", a+i);
    }
  int tar = -1;
  for (int i = 0; i < n-1; ++i)
    if (a[i]+a[i+1]>=l)
      {
	tar = i;
	break;
      }
  if (tar == -1)
    {
      puts("Impossible");
      return 0;
    }
  puts("Possible");
  tar += 1;
  for (int i = 1; i < tar; ++i)
    printf("%d\n", i);
  for (int i = n-1; i > tar; --i)
    printf("%d\n", i);
  printf("%d\n", tar);
}


Measured memory_bytes: 1152
import java.util.*;


class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        double W = sc.nextInt();
        double H = sc.nextInt();
        double x = sc.nextInt();
        double y = sc.nextInt();
        int split = 0;

        if(W/2D == x && H/2D == y)split=1;

        System.out.println(W*H/2D + " " + split);
    }
}

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

using namespace std;

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.14159265;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define CALL(x) x.cbegin(),x.cend()
#define RALL(x) x.rbegin(),x.rend()
#define CRALL(x) x.crbegin(),x.crend()

#define cout cout << setprecision(12)

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void dbg(T a) { cout << a << ' '; }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
//double d;
string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> n >> m;
	if (n == 1 || m == 1) {
    	dbg(1); return 0;
    }
    cout << (n * m + 1) / 2 << endl;
}


Measured memory_bytes: 256
#include<iostream>


using namespace std;

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

	if (S.length() == T.length() - 1) {
		for (int i = 0; i < S.length(); i++) {
			if (S.at(i) != T.at(i)) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	else {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;

}

Measured memory_bytes: 3628
// 2017-02-21
#include <iostream>
using namespace std;
#define N 1299709

int main() {
	static bool a[N + 1] = {true, true};
	static int b[N + 1], c[N + 1];
	{
		int t = 2;
		for (int i = 2; i <= N; i++) {
			if (a[i]) {
				b[i] = t;
			} else {
				c[t] = i - t;
				t = i;
				for (int j = 2 * i; j <= N; j += i) {
					a[j] = true;
				}
			}
		}
	}
	int n;
	while (cin >> n, n) {
		if (a[n]) {
			cout << c[b[n]] << endl;
		} else {
			cout << 0 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 14456
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	string s,t;
	ll ans=0;
	cin >> s >> t;
	for(ll i=0;i<s.length();i++){
		if(s[i]!=t[i]){
			ans++;
		}
	}
	cout << ans << endl;
}

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

int main()
{
	ll K, S; cin >> K >> S;
	ll ans = 0;
	for (int i = 0; i <= K; ++i) {
		for (int j = 0; j <= K; ++j) {
			ll z = S - i - j;
			if (z >= 0 && z <= K) ans++;
		}
	}
	cout << ans << endl;



}


Measured memory_bytes: 3624
N, M = map(int, input().split())
price_num = [[int(i) for i in input().split()] for _ in range(N)]
price_num = sorted(price_num, key=lambda x: x[0])

rest_necessary_num = M
necessary_money = 0
for pn in price_num:
    price, num = pn
    if rest_necessary_num >= num:
        # 安いところ買い切り
        necessary_money += price * num
        rest_necessary_num -= num
    else:
        # 残り必要な分だけ買う
        necessary_money += price * rest_necessary_num
        break

print(necessary_money)


Measured memory_bytes: 23524
# import math
# import bisect
# import heapq
# from collections import deque
# import numpy as np

# a,b,c = map(int, input().split())
n = int(input())
a = list(map(int,input().split()))

ans = 'APPROVED'
for i in range(n):
    b = a[i]
    if b%2==0 and not(b%3==0 or b%5==0):
        ans = 'DENIED'

print(ans)


Measured memory_bytes: 2940
#include "bits/stdc++.h"
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

int main() {
	/*string st; cin >> st;
	if (st.size()>=4&&st.substr(0,4) == "YAKI")cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;*/

	int N, M, K; cin >> N >> M >> K;
	bool ok = false;
	for (int i = 0; i <= N; ++i) {
		for (int j = 0; j <= M; ++j) {
			int a = i*M + j*N - 2*i*j;
			if (a == K)ok = true;
		}
	}
	if (ok)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    long long W, H, x, y;
    cin >> W >> H >> x >> y;
    float area;
    area = W * H / 2;
    if(W % 2 == 1 && H % 2 == 1) area += 0.5;
    cout << area << " ";
    if(2 * x == W && 2 * y == H) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
N = int(input())
def devide(n):
  if n < 4:
    return False
  elif n % 4 == 0:
    return True
  elif n % 7 == 0:
    return True
  else:
    return devide(n - 4) or devide(n - 7)

if devide(N):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 2940
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	char c;
	cin >> c;
	if(c >= 'A' && c <= 'Z') cout << 'A' << endl;
	else cout << 'a' << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
typedef long long ll;
using namespace std;
 
 
int main(){
    ll h,w; cin >> h >> w;
    if(h==1 || w==1) cout << 1 << endl;
    else if(h%2==1 && w%2==1) cout << h*w/2+1 << endl;
    else cout << h*w/2 << endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=201000;
int nxt[N][10],s[N];
ll dp[N];
int solve(VI c) {
	bool ss=0;
	rep(i,0,SZ(c)-1)  if (c[i]==c[i+1]) ss=1;
	if (!ss) return 1;
	int n=SZ(c);
	rep(i,0,n) s[i+1]=(s[i]+(c[i]?1:2))%3;
	rep(j,0,3) nxt[n][j]=n+1;
	per(i,0,n) {
		rep(j,0,3) nxt[i][j]=nxt[i+1][j];
		nxt[i][s[i+1]]=i+1;
	}
	dp[0]=1;
	ll ans=0;
	rep(i,1,n+1) dp[i]=0;
	rep(i,0,n+1) {
		rep(j,1,3) {
			int p=nxt[i][(s[i]+j)%3];
			if (p<=n) {
				dp[p]=(dp[p]+dp[i])%mod;
			}
		}
		if (i>0&&s[i]==s[n]) ans=(ans+dp[i])%mod;
	}
//	printf("%lld\n",ans);
	return ans;
}

char ss[N];
//int M=10;
int main() {
	scanf("%s",ss);
	int n=strlen(ss);
	VI c;
	rep(i,0,n) c.pb(ss[i]-'a');
	printf("%d\n",solve(c));
/*
	rep(S,0,(1<<M)) {
		VI c;
		rep(i,0,M) c.pb((S>>i)&1);
		set<VI> w;
		queue<VI> q;
		q.push(c);
		w.insert(c);
		while (!q.empty()) {
			VI cc=q.front(); q.pop();
			rep(i,0,SZ(cc)-1) if (cc[i]==cc[i+1]) {
				VI dd=cc; dd.erase(dd.begin()+i);
				dd[i]^=1;
				if (!w.count(dd)) w.insert(dd),q.push(dd);
			}
		}
		rep(i,0,M) printf("%c",'a'+c[i]); printf(" %d\n",SZ(w));
		assert(SZ(w)==solve(c));
	}*/
}


Measured memory_bytes: 8440
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
int main() {
	string s;
	cin >> s;
	set<char>se;
	rep(i, 3)
		se.insert(s[i]);
	if (se.count('a') && se.count('b') && se.count('c') && s.size() == 3)
		cout << "Yes";
	else
		cout << "No";
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define INPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in"
#define OUTPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

void solve()
{
    string s;
    cin >> s;
    int n = (int) s.length();
    int res = 0;
    for(int i = 0; i < n; i++)
    {
        res += (s[i] == '+') - (s[i] == '-');
    }
    cout << res;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    //freopen(INPUT, "r", stdin);freopen(OUTPUT, "w", stdout);
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

type PriorityQueue<'T>(compare: 'T -> 'T -> int) =
    let _heap = ResizeArray<'T>() // 二分ヒープ
    let _compare = compare // 比較関数
    let parent n = (n - 1) / 2
    let leftChild n = (n <<< 1) + 1
    let rightChild n = (n <<< 1) + 2

    let swap x y =
        let tmp = _heap.[x]
        _heap.[x] <- _heap.[y]
        _heap.[y] <- tmp

    /// ここでの比較は昇順ソートを基準に考えている
    member self.Compare(x: int, y: int) = (_compare _heap.[x] _heap.[y]) < 0

    /// O(log n)
    member self.Enque(x: 'T) =
        let size = _heap.Count
        _heap.Add(x)
        // 親と値を入れ替えていく
        let rec loop k =
            match k > 0 with
            | true ->
                let p = parent k
                match self.Compare(k, p) with
                | true ->
                    swap k p
                    loop p
                | _ -> ()
            | _ -> ()
        loop size

    /// O(log n)
    member self.Deque() =
        let res = _heap.[0]
        // 末尾ノードを根に持ってくる
        let size = _heap.Count - 1
        _heap.[0] <- _heap.[size]
        _heap.RemoveAt(size)
        // 葉ノードに達するまで子と値を入れ替えていく
        let rec loop k =
            let left = leftChild k
            match left < size with
            | true ->
                let right = rightChild k

                let c =
                    if right < size && self.Compare(right, left)
                    then right
                    else left
                match self.Compare(c, k) with
                | true ->
                    swap c k
                    loop c
                | _ -> ()
            | _ -> ()
        loop 0
        res

    member self.Any(): bool = _heap.Count > 0

    member self.Peek(): 'T = _heap.[0]

    member self.Dump() = String.Join(" ", _heap)

let greater (x: int64) (y: int64) = y.CompareTo(x)

let main() =
    let [| n; m |] = reada int
    let len = int 1e5 + 10
    let ab = Array.init len (fun _ -> ResizeArray<int64>())
    for i in 0 .. n - 1 do
        let [| a; b |] = reada int
        let b = int64 b
        // printfn "a:%d, b:%d, size:%d" a b (Array.length ab)
        ab.[a].Add(b)

    let mutable ans = 0L
    let que = PriorityQueue<int64>(greater)
    for d in 1 .. m do
        for b in ab.[d] do
            que.Enque(b)
        if que.Any() then
            let b = que.Deque()
            ans <- ans + b

    puts ans
    ()

main()
writer.Close()


Measured memory_bytes: 27144
# include <iostream>
using namespace std;
 
int main(void){
  int a, b;
 
  cin >> a >> b;

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

Measured memory_bytes: 1156
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
  ll n,x;
  cin >> n >> x;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i,n){
     cin >> a.at(i);
     b.at(i)=abs(x-a.at(i));
  }
  ll ans=b.at(0);
  rep(i,n){
     ans=__gcd(ans,b.at(i));
  }
  cout << ans << endl;
}
    

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

void solver() {
  int n;
  cin >> n;
  vector<int> cnts(10000000);
  vector<bool> primes(10000000);
  vector<bool> inAs(10000000);

  long long ans = 0;
  int maxA = -1;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    cnts[a]++;
    maxA = max(maxA, a);
  }

  for (int i = 1; i <= maxA; i++) {
    bool has = false;
    if (cnts[i] > 0) {
      has = true;
    } else {
      continue;
    }

    if (!inAs[i] && cnts[i] == 1) {
      ans++;
    }
    
    for (int j = i; j <= maxA; j=j+i) {
      primes[j] = true;
      inAs[j] = has;
    }
  }

  cout << ans << "\n";
}

int main() {
  solver();
  return 0;
}


Measured memory_bytes: 44704
n = gets.to_i

n.downto(1) do |i| # 1回繰り返す毎に1ずつ数値は減少
  if (i ** 0.5 ) == (i ** 0.5 ).to_i # 計算式これでいいのかわからない
    puts i
    break  # １コで終了
  end
end

# puts ans 

Measured memory_bytes: 1916
n,m = map(int,input().split())
a = list(map(int,input().split()))
l = [list(map(int,input().split())) for _ in range(m)] + [[1,0]]
a.sort()
l.sort(key=lambda x:x[1])
for i in range(n):
  if a[i] < l[-1][1]:
    a[i] = l[-1][1]
    l[-1][0] -= 1
    if l[-1][0] == 0:
      l.pop()
  else:
    break
print(sum(a))

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

int A, B, C, X; 

int main() {
    cin >> A >> B >> C >> X;
    int res = 0;
    for(int a=0;a<=A;a++){
      for(int b=0;b<=B;b++){
        for(int c=0;c<=C;c++){
          if(X == 500*a + 100*b + 50*c) res++;
        }
      }
    }
    cout << res << endl;
}

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

int main() {
	int a, b, k;
	int ans = 0;
	cin >> a >> b >> k;
	int c = min(a, b);

	for (int i = 0; i < c; i++) {
		if (a % (c-i) == 0 && b % (c-i) == 0) {
			k--;
		}
		if (k <= 0) {
			ans = c-i;
			break;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
k = int(input())
if k % 7 == 0:
    L = 9 * k / 7
else:
    L = 9 * k
 
if L % 2 == 0 or L % 5 == 0:
    print(-1)

m = 10

for i in range(k):
    m = m % L
    if m == 1:
        print(i + 1)
        exit()
    else:
        m = m * 10

Measured memory_bytes: 9188
#include <stdio.h>
#include <math.h>

int main(){
    double x1, y1, x2, y2, distance;
    
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    
    distance = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
    
    printf("%.8f\n", distance);
    
    return 0;
}

Measured memory_bytes: 656
#include <bits/stdc++.h>
#define int long long 

using namespace std;
const int somod = 998244353;
const int maxn = 4007;
int n, k, fact[maxn], invfact[maxn], pow2[maxn];

int Pow(int a, int b)
{
    int ans = 1;
    for(; b > 0; b >>= 1, a = a * a % somod)
    {
        if(b & 1)
        {
            ans = ans * a % somod;
        }
    }
    return ans;
}

void prepare()
{
    fact[0] = 1;
    for(int i = 1; i < maxn; i++)
    {
        fact[i] = fact[i - 1] * i % somod;
    }
    invfact[maxn - 1] = Pow(fact[maxn - 1], somod - 2);
    for(int i = maxn - 2; i >= 0; i--) invfact[i] = (invfact[i + 1] * (i + 1)) % somod;
    pow2[0] = 1; 
    for(int i = 1; i < maxn; i++)
    {
        pow2[i] = pow2[i - 1] * 2;
        if(pow2[i] >= somod) pow2[i] -= somod;
    }
}

int C(int k, int n)
{
    if(k > n || k < 0 || n < 0) return 0;
    return fact[n] * invfact[k] % somod * invfact[n - k] % somod;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen("test.inp", "r")) freopen("test.inp", "r", stdin);
    cin >> k >> n;
    prepare();
    for(int i = 2; i <= k + k; i++)
    {
        int pair = min(k, i - 1) - i / 2;
        int ans = 0;
        int rest = k - pair - pair - (i % 2 == 0);
        for(int j = 0; j <= pair; j++)
        {
            ans += C(j, pair) * C(rest + j - 1, n - j + (rest + j) - 1) % somod * pow2[j];
            ans %= somod;
        }
        if(i % 2 == 0)
        {
            for(int j = 0; j <= pair; j++)
            {
                ans += C(j, pair) * C(rest + j - 1, n - 1 - j + (rest + j) - 1) % somod * pow2[j];
                ans %= somod;
            }
        }
        cout << ans << '\n';
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;

typedef tuple<long long, int> E;

int W, H;
long long p[100000];
long long q[100000];
vector<E> e;
int h, w;
int main(){
  cin >> W >> H;
  REP(i,W){
    cin >> p[i];
    e.emplace_back(p[i], 0);
  }
  REP(j,H){
    cin >> q[j];
    e.emplace_back(q[j], 1);
  }
  sort( e.begin(), e.end() );
  long long ans = 0;
  for( auto edge : e ){
    long long c;
    int t;
    tie(c,t) = edge;
    if( t == 0 ){
      //cout << "t=0" << " H=" << H << " h=" << h << " c=" << c << endl;
      ans += (H + 1 - h) * c;
      w++;
    }else{
      //cout << "t=1" << " W=" << W << " w=" << w << " c=" << c << endl;
      ans += (W + 1 - w) * c;
      h++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5488
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <vector>

using namespace std;

// #define DEBUG 1
#define DFILE "t1.1"

int main() {
  int n, k;
  string s;

#ifdef DEBUG
#define cin fin
  fstream fin(DFILE);
#endif

  cin >> n >> k;
  cin >> s;
  s[k - 1] = s[k - 1] - ('A' - 'a');
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <cstring>

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))

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

using namespace std;

int main() {
    int n;
    long long a, b;

    cin >> n;
    cin >> a >> b;

    int now = 0;
    cin >> now;

    vector<long long> dp(n+1);
    dp[0] = 0;
    for(int i = 0; i < n-1; i++){
        int c = 0;
        cin >> c;
        dp[i+1] = min(dp[i] + b, dp[i] + (c - now)*a);
        now = c;
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  N = int(input())
  A = [list(map(int, input().split())) for _ in range(N)]
  dp = [0]*(1<<N)
  dp[0] = 0
  for i in range(2,N+1):
    for com in combinations(range(N),i):
      S = 0
      for c in com:
        S += 1<<c
      last = com[-1]
      dp[S] = dp[S-(1<<last)]
      for c in com:
        dp[S] += A[last][c]
  for i in range(2,N+1):
    for com in combinations(range(N),i):
      S = 0
      for c in com:
        S += 1<<c
      T = (S-1)&S
      while T>0:
        dp[S] = max(dp[S],dp[T]+dp[S-T])
        T = (T-1)&S
  ans = dp[-1]
  return ans
print(solve())

Measured memory_bytes: 74300
#include <bits/stdc++.h>
#define io_optimized ios::sync_with_stdio(false);cin.tie(0);
using namespace std;

int main(){
#define int int_fast64_t
	io_optimized
	int n,k;
	while(cin>>n>>k)
	{
		int a=0;
		for(int i=0;i<2147483647;i++)
		{
			a++;
			if(pow(k,i)>n)
			{
				break;
			}
		}
		cout<<a-1<<"\n";
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
ll INF = 1e12+10;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
vector<pair<ll, ll> > pairs;

const ll MAX = 10000000000 * 300 + 10;
ll dp[310][310];
int main()
{
    ll N, K, tmp;
    cin >> N >> K;
    vector<ll> H(N + 2);
    rep(i, N)cin >> H[i + 1];
    H[0] = H[N + 1] = 0;
    
    //rep(i, N)cout << H[i + 1]  << endl;
    for (int i = 0; i <= N; i++){
        dp[0][i] = MAX;
        dp[i][0] = 0;
    }
    
    for (int i = 1; i <= N; i++){
        for (int j = 1; j <= N; j++){
            tmp = MAX;
            for (int i0 = 0; i0 < i; i0++){
                if (j - 1 == 0){
                    tmp = H[i];
                } else {
                    tmp = min(tmp, dp[i0][j - 1] + max(0LL, H[i] - H[i0]));
                }
                //fprintf(stderr, "i0 = %d, tmp = %d\n", i0, tmp);
            }
            dp[i][j] = tmp;
            //cout << i << " " << j << " " << tmp << endl;
            //fprintf(stderr, "dp[%d][%d] = %Ld\n", i, j, tmp);
        }
    }
    ll ans = MAX;
    for (int i = 1; i <= N; i++){
        ans = min(ans, dp[i][N - K]);
    }
    cout << ans;
    return 0;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a + b == c + d) {
    cout << "Balanced" << endl;
  }
  else if (a + b > c + d) {
    cout << "Left" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#define maxn 100005
using namespace std;
typedef long long ll;

template <typename T>void read(T &t)
{
	t=0;int f=0;char c=getchar();
	while(!isdigit(c)){f|=c=='-';c=getchar();}
	while(isdigit(c)){t=t*10+c-'0';c=getchar();}
	if(f)t=-t;
}

int n;
char s[maxn];
int top;
int ans;

int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	int cur;
	for(register int i=n;i;--i)
	{
		if(top==0)
		{
			cur=s[i];
			++top;
		}
		else if(cur==s[i])
			++top;
		else
			--top,ans+=2;
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
    string S = "MARCH";
    long long C[5] = {0};
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        string str;
        cin >> str;
        for (int j = 0; j < 5; j++) {
            if(str[0] == S[j]){
                C[j]++;
            }
        }
    }
    
    long long ans = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = i+1; j < 5; j++) {
            for (int k = j+1; k < 5; k++) {
                ans += C[i] * C[j] * C[k];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys

def main():
    def input():
        return sys.stdin.readline()
    N = int(input())
    S = "_" + input()

    dp = [[0 for k in range(N+1)] for l in range(N+1)]

    for k in range(1,N):
        for l in range(k+1,N+1):
            if S[k] == S[l]:
                dp[k][l] = dp[k-1][l-1] + 1
    ans = 0
    for k in range(1,N):
        for l in range(k+1,N+1):
            if l-k >= dp[k][l]:
                ans = max(ans,dp[k][l])

    print(ans)
if __name__ == '__main__':
    main()


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

int main()
{
	int n, h[25];
	scanf ("%d", &n);
	int i;
	for (i=0; i<n; i++)
		scanf ("%d", &h[i]);
	
	int j, tag;
	int num=1;
	for (i=1; i<n; i++)
	{
		tag=1;
		for (j=0; j<i; j++)
			if (h[j]>h[i]) tag=0;
		if (tag) num++;
	}
	printf("%d\n", num);
	return 0;
}

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

char id[260][20];

bool isin(int n, char s[20]){
    for(int i=0;i<n;++i){
        if(!strcmp(id[i], s)) return true;
    }
    return false;
}

int main(void){
    int n, m;
    bool isOpen = false;
    char user[20];
    cin >> n;
    for(int i=0;i<n;++i){
        cin >> id[i];
    }
    cin >> m;
    for(int i=0;i<m;++i){
        cin >> user;
        bool in = isin(n, user);
        if(in){
            if(isOpen){
                cout << "Closed by " << user << endl;
                isOpen = false;
            }else{
                cout << "Opened by " << user << endl;
                isOpen = true;
            }
        }else{
            cout << "Unknown " << user << endl;
        }
    }
}


Measured memory_bytes: 3140
#ifdef __GNUC__
#pragma GCC target("avx2")
#pragma GCC optimize ("O25")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC optimize("unroll-loops")
#define iss std::cin
#endif
#include "bits/stdc++.h"
#define rep(i, times) for(ll i = 0; i < (times); ++i)
#define p(x) (cout << x << "\n")
using ll = long long; using ld = long double; using namespace std;

#ifndef __GNUC__
string text =
R"X(
2
4294967296 4294967296
)X";
stringstream iss{text};
#endif 

class AtCoder
{
	ll N{0};
	vector<ll> p;
	void inp( ) {
		iss >> N; p.resize(N); //q.resize(N);
		rep(n, N) { iss >> p[n]; }
		//rep(n, N) { iss >> q[n]; }
		//for_each(begin(p), end(p), [](auto x) { cout << x << "\n"; });
	}
	ll change( ) {
		ld s{1};
		const ld maxS = ll(pow(10, 18));
		rep(n, N) { if (p[n] == 0) { return 0; } }
		rep(n, N) {
			if (s > maxS) {
				return -1;
			}
			s *= p[n];
		}
		if (s > maxS) { return -1; }
		return ll(s);
	}
public:
	void procedures( ) {
		inp( );
		p(change( ));
	}
};
int main( ) {
	cin.tie(0);	ios::sync_with_stdio(0);
	class AtCoder a; a.procedures( );
}


Measured memory_bytes: 3988
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N, M;
  cin >> N >> M;
  vl A(M);
  ll sum = 0;
  REP(i, M) {
    cin >> A[i];
    sum += A[i];
  }
  cout << max((ll)-1, N - sum) << endl;

  return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define vvdebug(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main () {
	int N, R; cin >> N >> R;
	int ans = R;
	if (N < 10) ans += 100 * (10 - N);
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		Node[] v = new Node[N];
		Edge[] e = new Edge[M];
		for(int i=0;i<N;i++) {
			v[i] = new Node(i);
		}
		int a,b;
		long c;
		for(int i=0;i<M;i++) {
			a = Integer.parseInt(sc.next());
			b = Integer.parseInt(sc.next());
			c = -Long.parseLong(sc.next());
			e[i] = new Edge(v[a-1],v[b-1],c);
			v[a-1].Connect(e[i]);
		}
		Graph map = new Graph(v,e);
		long dist1;
		if(map.Bellman_Ford(v[0])) {
			dist1 = v[N-1].d;
			map.Bellman_Ford(v[0]);
			if(dist1 == v[N-1].d) {
				out.println(-dist1);
			}
			else {
				out.println("inf");
			}
		}
		else {
			out.println(-v[N-1].d);
		}


		out.flush();
	}
}

class Graph{
	static Node[] nodes;
	static Edge[] edges;

	public Graph(Node[] v,Edge[] e) {
		Graph.nodes = v;
		Graph.edges = e;
	}

	public static int size() {
		return nodes.length;
	}

	public boolean Bellman_Ford(Node s) {
		boolean negative_loop[] = new boolean[size()];
		Arrays.fill(negative_loop, false);
		s.Reload_dist(0);
		for(int i=0;i<size();i++) {
			for(Node v : nodes) {
				for(Edge e : v.edges) {
					if((v.d != Long.MAX_VALUE && e.Other_one(v).d > v.d + e.cost)) {
						e.Other_one(v).Reload_dist(v.d + e.cost);
						negative_loop[e.Other_one(v).id] = true;
					}
					if(i==size()-1) {
						return true;
					}
				}
			}
		}
		return false;
	}

}

class Node{
	int id;
	long d;
	Node prev = null;
	ArrayList<Edge> edges = new ArrayList<>();

	public Node(int id) {
		this.id = id;
		this.d = Long.MAX_VALUE;
	}

	public void Reset() {
		this.d = Long.MAX_VALUE;
		this.prev = null;
	}

	public void Reload_dist(long dist) {
		this.d = dist;
	}

	public void Reload_prev(Node v) {
		this.prev = v;
	}

	@Override public Node clone() {
		return new Node(this.id);
	}

	public void Connect(Edge e) {
		edges.add(e);
	}
}

class Edge{
	Node v1, v2;
	long cost;
	public Edge(Node id1,Node id2, long c) {
		this.v1 = id1;
		this.v2 = id2;
		this.cost = c;
	}

	public Node First_one() {
		return this.v1;
	}

	public Node Second_one() {
		return this.v2;
	}

	public Node Other_one(Node v) {
		if(v.equals(this.v1)) {
			return this.v2;
		}
		else {
			return this.v1;
		}
	}
}

Measured memory_bytes: 49532
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<ll> a(n+1),s(n+1);
    for(auto&i:a) cin>>i;
    if(!n){
        if(a[0]-1) puts("-1");
        else puts("1");
        return 0;
    }
    if(a[0]) return puts("-1"),0;
    iFr(i,n) s[i-1]=s[i]+a[i];
    ll ans{1},l{1};
    Fr(i,n){
        l*=2;
        chmin(l,s[i-1]);
        if(a[i]>l) return puts("-1"),0;
        ans+=l;
        l-=a[i];
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  string s;
  int res=0;

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s[i];
  }
  
  for (int i=0;i<n;i++){
    if(s[i]=='Y'){
      res++;
      break;
    }
  }
 
if (res>0){
  cout <<"Four"<<endl;
}else{
  cout<<"Three"<<endl;
}
 
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
#define nl '\n'
#define ll long long 
#define ull unsigned long long
#define debug(x)       { cerr << #x << " = " << x << endl; } 
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
 
const int Max = (int)2e5+5;
 
//functions
ll lcm(ll a,ll b) {if(a==0 || b==0){return 0;}else{return (a*b)/__gcd(a,b);}}
 
//direction arry
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
//____________________________________________________________________________________________________
void solve()
{
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='7')
        {
            cout<<"Yes"<<endl;
            return ;
        }
    }
    cout<<"No"<<endl;
}
int main()
{
    fastread;
    int tc=1;
    // cin>>tc;
    while(tc--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3620
N, M = list(map(int, input().split()))

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N - M + 1):
    for j in range(N - M + 1):
        result = True
        for x in range(M):
            for y in range(M):
                sA = A[i + x][j + y]
                sB = B[x][y]
                if sA != sB:
                    result = False
                    break
            if result is False:
                break

        if result is True:
            print("Yes")
            exit()

print("No")


Measured memory_bytes: 3064
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int slength = s.length();
        char[] c = s.toCharArray();
        int[] cInt = new int[slength];
        int[] cIntSum = new int[slength+1];
        for (int i=0;i<slength;i++) {
            cInt[s.length()-1-i] = Character.getNumericValue(c[i]);
        }
        cIntSum[0] = 0;
        Map<Integer, Integer> sumMap = new HashMap<>();
        sumMap.put(0, 1);
        int n = 1;
        int ans = 0;
        for (int i=1;i<=slength;i++) {
            cIntSum[i] = (cInt[i-1]*n + cIntSum[i-1])%2019;
            if (sumMap.containsKey(cIntSum[i])) {
                ans += sumMap.get(cIntSum[i]);
                sumMap.put(cIntSum[i], sumMap.get(cIntSum[i]) + 1);
            } else {
                sumMap.put(cIntSum[i], 1);
            }
            n *= 10;
            n %= 2019;
        }

        System.out.println(ans);
    }
}




Measured memory_bytes: 57396
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
#include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<long long>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atoll(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atoll(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(long long);
		void decrement(void);
		void decrement(long long);
		long long getResult(void);
	private:
		long long result;
	};
	void Ans::showResult(void) {
		printf("%lld\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(long long value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(long long value) {
		this->result -= value;
	}
	long long AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
	void rsort(std::vector<int>* vec) {
		std::sort(vec->begin(), vec->end(), std::greater<int>());
	}
}

int main(void) {

	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();

	const int size = data->getNum()[0];
	const int max = data->getNum()[1] - 1;
	data->getInput();

	AtCoder::Num H = data->getNum();
	AtCoder::Num bufans;

	for (int i = 0; i < max; i++) {
		bufans.push_back(std::abs(H.at(i + 1) - H.at(i)));
	}
	bufans.push_back(std::abs(size - H.at(max) + H.at(0)));

	AtCoder::rsort(&bufans);
	AtCoder::Ans* ans = new AtCoder::Ans();
	for (int i = 1; i < bufans.size(); i++) {
		ans->increment(bufans.at(i));
	}

	ans->showResult();

	delete(ans);
	delete(data);

	return 0;
}


Measured memory_bytes: 12528
import qualified Data.ByteString.Char8 as BS
import           Data.List
import           Data.Maybe

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

solve :: Integer -> [Integer] -> Integer
solve n [] = n
solve n xs = head [n + b * a | a <- [0..n], b <- [-1, 1], (n + b * a) `notElem` xs]

main :: IO ()
main = do
  [n,m] <- getIntList
  fl <- if m == 0 then return [] else getIntList
  print $ solve n fl


Measured memory_bytes: 3856
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main () {
  long N, A, B, ans;
  cin >> N >> A >> B;
  long sum = A + B;
  long tmp = N / sum;
  ans = tmp * A;
  tmp = N % sum;
  if (tmp > A) {
    ans += A;
  } else {
    ans += tmp;
  }
  printf("%ld\n", ans);
  return 0;
}

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

main(){
  string s;
  cin>>s;
  sort(s.begin(),s.end());
  if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <ostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main()
{
    int a, b, c;

    cin >> a >> b >> c;

    if (a == b) {
        if (b == c) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
    else if (a == c) {
        if (a == b) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
    else if (b == c) {
        if (b == a) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
    else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#define _USE_MATH_DEFINENS
#include <cmath>
using namespace std;

#define MOD 1000000007
#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    string h, d;
    cin >> h >> d;

    if(h == d){
        cout << "H";
    }else{
        cout << "D";
    }
    el;
}


Measured memory_bytes: 256