akhauriyash/Code-Regression huggingface dataset:
/*   --------------------
    |       LOSER        |
    |     ~NOOBOSS~      |
     --------------------
*/
#include <bits/stdc++.h>
using namespace std;

#define      inl(x)              scanf("%lld",&x)
#define      in(x)               scanf("%d",&x)
#define      mxx                 10000000000000
#define      mnn                 -10000000000000
#define      Y()                 cout<< "Yes" <<endl
#define      N()                 cout << "No"<<endl
#define      endl                "\n"
#define      max_3(a,b,c)        max(a, max(b,c))
#define      max_4(a,b,c,d)      max(a,max(b,max(c,d)))
#define      min_3(a,b,c)        min(a, min(b,c))
#define      min_4(a,b,c,d)      min(a,min(b,min(c,d)))
#define      gcd(a,b)            __gcd(a,b)
#define      lcm(a,b)           (a*b)/gcd(a,b)
#define      loser               return 0
#define      ll                  long long
#define      PI                  acos(-1)
#define      mem(a,v)            memset(a,v,sizeof(a))
#define      SORT(v)             sort(v.begin(),v.end())
#define      REV(v)              reverse(v.begin(),v.end())
#define      O(x)                cout<<x<<endl
#define      B                   begin()
#define      E                   end()
#define      V                   vector
#define      F                   first
#define      S                   second
#define      PSB                 push_back
#define      EMB                 emplace_back
#define      MP                  make_pair
#define      PII                 pair<int,int>
#define      MII                 map<int,int>
#define      FAST()              ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
const ll MOD = 998244353;
//auto it=std:: unique(v.B,v.E);
//v.resize(std::distance(v.B,it));
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
/*-----*/
#define bug1(a)  cout<<a<<endl;
#define bug2(a,b)  cout<<a<<" "<<b<<endl;
#define bug3(a,b,c)  cout<<a<<" "<<b<<" "<<c<<endl;
/*----*/
ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
ll binpow(ll a, ll b){ll res = 1;while (b > 0) {if (b & 1)res*=a;a*=a;b>>=1;}return res;}
ll fact(ll num){ll fac=1;while(num!=1){fac=fac*num;num--;}return fac;}
string to_binary(int x) {string s;while(x > 0) {s += (x % 2 ? '1' : '0');x /= 2;}reverse(s.begin(), s.end());return s;}
ll nsum(ll num){return (num*(num+1))/2;}
/*-----*/
const int N=2e5+5;

/*-----*/
//vector<int> v[202];

/*-----*/
int main()
{
	FAST();

       ll test=1;
       //cin>>test;
       while(test--){
           ll n,x,y;
           string s;
           cin>>x>>y;
           if(y>=(x*2) && y<=(x*4) && y%2==0)
            Y();
           else N();

        }
	loser;
}
///////LeArN MoRe AnD Wait FoR ThE Result///////


Measured memory_bytes: 3624
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int main(){
	long long int n, m, i, j;
	scanf("%lld", &n);
	scanf("%lld", &m);
	if(n==1 && m==1){
		printf("%lld\n", n*m);
	}
	else if(n==1 || m==1){
		printf("%lld\n", n*m-2);
	}
	else {
		printf("%lld\n", (n-2)*(m-2));
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define long long long int
using namespace std;

// @author: pashka

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

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> d(n);
    for (int i = 0; i < n; i++) d[a[i]]++;
    if (a[0] != 0 || d[0] != 1) {
        cout << 0;
        return 0;
    }

    long res = 1;
    for (int i = 1; i < n; i++) {
        int x = a[i];
        res *= d[x - 1];
        res %= 998244353;
    }
    cout << res << "\n";

    return 0;
}

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

#define CO const
#define IN inline
typedef long long int64;

template<class T> IN T read(){
	T x=0,w=1;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-') w=-w;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*w;
}
template<class T> IN T read(T&x){
	return x=read<T>();
}

CO int N=2e5+10;
vector<int> to[N];
int deg[N];
char str[N];
int tag[N],tot;
int val[N],p;
int dp[N][2],f[N];

void check(int u,int fa){
	if(str[u]=='W') tag[u]=1;
	for(int v:to[u])if(v!=fa){
		check(v,u);
		if(!tag[v]) --deg[u],--deg[v];
		tag[u]|=tag[v];
	}
	tot+=tag[u];
}
void dfs(int u,int fa){
	f[u]=2*(tot-1)+p;
	dp[u][0]=val[u]?-1:1;
	for(int v:to[u])if(v!=fa and tag[v]){
		dfs(v,u);
		f[u]=min(f[u],f[v]);
		f[u]=min(f[u],2*(tot-1)+p-dp[u][0]-dp[v][1]-1);
		f[u]=min(f[u],2*(tot-1)+p-dp[u][1]-dp[v][0]-1);
		dp[u][0]=max(dp[u][0],dp[v][0]+1+(val[u]?-1:1));
		dp[u][1]=max(dp[u][1],dp[v][1]+1+(val[u]?-1:1));
	}
}
int main(){
	int n=read<int>();
	for(int i=1;i<n;++i){
		int u=read<int>(),v=read<int>();
		to[u].push_back(v),to[v].push_back(u);
		++deg[u],++deg[v];
	}
	scanf("%s",str+1);
	int rt=0;
	for(int i=1;i<=n;++i)if(str[i]=='W') rt=i;
	check(rt,0);
	for(int i=1;i<=n;++i)if(tag[i]) val[i]=(str[i]=='B')^(deg[i]&1),p+=!val[i];
	dfs(rt,0);
	printf("%d\n",!tot?tot:f[rt]);
	return 0;
}


Measured memory_bytes: 18304
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 N;
	cin >> N;
	i64 sum_p = 0;
	i64 high_p = 0;
	REP(i, N)
	{
		i64 p;
		cin >> p;
		sum_p += p;
		if (high_p < p)
			high_p = p;
	}
	cout << (sum_p - high_p + high_p / 2) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N, K;
  int ans = 1;
  cin >> N >> K;
  for (int i = 0; i < N; i++){
    if (ans > K){
      ans+= K;
    }
    else {
      ans = 2 * ans;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque
N = int(input())

alphabet = "abcdefghij"
visited = 1
st = deque([["a", visited]])

while len(st) > 0:
    str, visited = st.popleft()

    if len(str) == N:
        print(str)
    else:
        # すでに使った文字を使う
        for x in alphabet[0 : visited]:
            st.append([str + x, visited])
        # まだ使っていない文字を使う
        # len(str) < Nだから、visited < N
        st.append([str + alphabet[visited], visited + 1])


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

int main(){
  string S;
  
  cin >> S;
  
  if(S.at(2)==S.at(3)&&S.at(4)==S.at(5)){
    cout << "Yes" <<endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
w = [input().rstrip() for _ in range(n)]
w_alter = []

# print(w,w_alter)

for i in range(n-1):
    w_alter.append(w.pop(0))
    if w_alter[i] in w:
        # print(w_alter[i])
        print("No")
        exit()
    if w_alter[i][-1] != w[0][0]:
        # print(i)
        # print(w,w_alter)
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 3064
S = gets.chomp

A = S.chars.take(2).join.to_i
B = S.chars.drop(2).join.to_i

Month = [*1..12]

ans = if Month.include?(A) and Month.include?(B) then
          "AMBIGUOUS"
      elsif Month.include?(A) and (not Month.include?(B)) then
          "MMYY"
      elsif (not Month.include?(A)) and Month.include?(B) then
          "YYMM"
      else
          "NA"
      end

puts ans



Measured memory_bytes: 1788
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

/**
 * Affine Cipher
 */
public class Main {

	static final char[][] hints = {{'t', 'h', 'i', 's'}, {'t', 'h', 'a', 't'}};

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = parseInt(br.readLine());

		for (int i = 0; i < n; i++) {
			String s = br.readLine();
			int[] c = cipher(s);
			int[] d = new int[26];
			for (int j = 0; j < 26; j++) {
				d[(c[0] * j + c[1]) % 26] = j;
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < s.length(); j++) {
				if (s.charAt(j) == ' ') {
					sb.append(' ');
				} else {
					sb.append((char) (d[s.charAt(j) - 'a'] + 'a'));
				}
			}
			System.out.println(sb.toString());
		}
	}

	static int[] cipher(String s) {

		int[] ret = new int[2];

		StringTokenizer st = new StringTokenizer(s);

		while (st.hasMoreTokens()) {

			String w = st.nextToken();

			if (w.length() == 4) {

				char[] hint = (w.charAt(0) != w.charAt(3) ? hints[0] : hints[1]);

				for (int a = 0; a < 26; a++) {
					if (a % 2 != 0 && a % 13 != 0) {
						for (int b = 0; b < 26; b++) {
							StringBuilder h = new StringBuilder();
							for (int i = 0; i < hint.length; i++) {
								h.append((char) (((a * (hint[i] - 'a') + b) % 26) + 'a'));
							}
							if (w.equals(h.toString())) {
								ret[0] = a;
								ret[1] = b;
								return ret;
							}
						}
					}
				}
			}
		}

		return ret;
	}
}

Measured memory_bytes: 27412
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
constexpr long long MMOD = 500000004;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

int a[202020], b[202020], n,p[202020];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		p[i]--;
	}
	for (int i = 0; i < n; i++) {
		a[i] = b[n - i - 1] = 45000 * i + 1;
	}
	for (int i = 0; i < n; i++)a[p[i]] += i;
	for (int i = 0; i < n; i++) {
		cout << a[i] << (i == n - 1 ? "\n" : " ");
	}
	for (int i = 0; i < n; i++) {
		cout << b[i] << (i == n - 1 ? "\n" : " ");
	}
}

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

using namespace std;

int main() {
  int x, y;
  cin >> x >> y;
  const vector<int> table = {1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1};
  if (table[x-1] == table[y-1]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

int main() {
  char c;
  cin >> c;
  cout << (char)(c + 1) << endl;
  return 0;
}

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

void solve() {
  int n, d;
  cin >> n >> d;
  vector<int> v[n];
  rep(i,n) {
    rep(j,d) {
      int x;
      cin >> x;
      v[i].emplace_back(x);
    }
  }
  int ans = 0;
  
  rep(i,n) {
	for(int j = i + 1; j < n; j++){
      int temp = 0;
      rep(k, d) {
      	temp += pow(v[i][k] - v[j][k],2);
      }
      for (int k = 1; k*k <= temp; k++) {
        if (k*k == temp) {
          ans++;
        }
      } 
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a, b;
    while(1){
        scanf("%d %d", &a, &b);
        if(a == 0 && b == 0)break;

        if(a > b)printf("%d %d\n", b, a);
        else printf("%d %d\n", a, b);
    }
}


Measured memory_bytes: 2040
from math import gcd
from functools import reduce

def factors(n):
    f=set()
    i=2
    while i*i<=n:
        if n%i==0:
            n//=i
            f.add(i)
        else:
            i+=1
    if n>1:
        f.add(n)
    return f

def list_gcd(A:list):
    return reduce(gcd,A)

N = int(input())
A = list(map(int,input().split()))

A_gcd=list_gcd(A)

p=set()
coprime=False
for a in A:
    f=factors(a)
    if len(f&p)>0:
        coprime=True
        break
    else:
        p|=f

if A_gcd==1:
    if coprime:
        print("setwise coprime")
    else:
        print("pairwise coprime")
else:
    print("not coprime")


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

int main()
{
  int n,k;
  int r,s,p;
  string T;
  cin >> n >> k;
  cin >> r >> s >> p;
  cin >> T;
  int ans = 0,cnt[3] = {0, 0, 0};
  for(int i=0;i<n;i++)
  {
    if(i < k)
    {
      if(T[i] == 'r')
        ans += p;
      else if(T[i] == 's')
        ans += r;
      else
        ans += s;
    }
    else
    {
      if(T[i] == 'r')
      {
        if(T[i-k] != 'r')
          ans += p;
        else
          T[i] = 'R';
      }
      else if(T[i] == 's')
      {
        if(T[i-k] != 's')
          ans += r;
        else
          T[i] = 'S';
      }
      else if(T[i] == 'p')
      {
        if(T[i-k] != 'p')
          ans += s;
        else
          T[i] = 'P';
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
import sys

n, x, *lst1 = map(int, sys.stdin.read().split())
res1 = 0
lst2 = [0] + lst1
lst1.append(0)
for i in range(n):
  tmpsum = lst2[i] + lst2[i + 1]
  if tmpsum > x:
    res1 += tmpsum - x
    lst2[i + 1] -= tmpsum - x

print(res1)

Measured memory_bytes: 14092
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfInt()
    val ans = A.all {
        if (it % 2 == 0) {
            (it % 3 == 0 || it % 5 == 0)
        } else true
    }
    println(if (ans) "APPROVED" else "DENIED")
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
fun printErr(value: Any) = System.err.println(value)


Measured memory_bytes: 38160
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  long long sum=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    a[i]=a[i]-i-1;
  }
  sort(a.begin(),a.end());
  int b=a[n/2];
  for(int i=0;i<n;i++){
    sum+=abs(a[i]-b);
  }
  cout << sum << endl;
}

Measured memory_bytes: 1024
# include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
# define pb push_back
# define pii pair < int, int >
# define F first
# define S second
# pragma GCC optimize("unroll-loops")
# pragma GCC optimize("Ofast")
# define int long long int
# define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int N=2e5+100,inf=1e15,mod=998244353 ;
vector <int> g[N];
ll k=0;
map <pii,int> mp;
ll dfs(ll v,ll p){
    ll cnt=1;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u==p){
            continue;
        }
        if (cnt==mp[{v,p}]){
            cnt++;
        }
        mp[{u,v}]=cnt;
        mp[{v,u}]=cnt;
        dfs(u,v);
        cnt++;
    }
}
int32_t main(){
    sync;
    ll n;
    cin >> n;
    vector <pii> yal;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
        yal.pb({u,v});
        k=max(k,(ll)g[v].size());
        k=max(k,(ll)g[u].size());
    }
    dfs(1,1);
    cout << k << endl;
    for (int i=0;i<n-1;i++){
        cout << mp[yal[i]] << endl;;
    }

}


Measured memory_bytes: 22896
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <unordered_set>

using namespace std;

int main() {
  string s;
  cin >> s;
  int ia = -1, iz = -1;

  for (int i = 0; i < s.size(); i++) {
    if ((char)s[i] == 'A') {
      ia = i;
      break;
    }
  }

  for (int k = s.size() - 1; k >= 0; k--) {
    if ((char)s[k] == 'Z') {
      iz = k;
      break;
    }
  }

  cout << iz - ia + 1 << endl;
}


Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;
ll a[200010];
ll sum[200010];
int main()
{
	ll n;
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%lld", &a[i]);
		sum[i] = sum[i - 1] + a[i];
	}
	ll dap = 1e18;
	for (int i = 1; i < n; i++)
	{
		dap = min(dap, abs(sum[i] - (sum[n] - sum[i])));
	}
	printf("%lld", dap);
}

Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;

int main(){
	int p1[10],p2[10];
	for(int i=0;i<2;i++){
		for(int j=0;j<10;j++){
			if(i==0) scanf("%d",p1+j);
			else scanf("%d",p2+j);
		}
	}

	sort(p1,p1+10,greater<int>());
	sort(p2,p2+10,greater<int>());
	printf("%d %d\n",p1[0]+p1[1]+p1[2],p2[0]+p2[1]+p2[2]);
}

Measured memory_bytes: 0
import java.util.Scanner;

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

        // 入力データの取得
        Scanner scanner = new Scanner(System.in);
        String inputHPAndCountData = scanner.nextLine();
        String inputSkillDamageData = scanner.nextLine();
        scanner.close();

        // 入力データの編集
        String[] editedInputHPAndCountData = inputHPAndCountData.split(" ");
        int enemyHP = Integer.parseInt(editedInputHPAndCountData[0]);
        int skillCount = Integer.parseInt(editedInputHPAndCountData[1]);
        long totalDamage = 0;
        if (skillCount != 1) {
            String[] skillDamageList = inputSkillDamageData.split(" ");
            int[] skillDamage = new int[skillCount];
            for (int index = 0; index < skillCount; index++) {
                skillDamage[index] = Integer.parseInt(skillDamageList[index]);
                totalDamage += skillDamage[index];
            }
        } else {
            totalDamage = Integer.parseInt(inputSkillDamageData);
        }

        // 判定
        if (totalDamage >= enemyHP) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    }

}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<VB> VVB;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REPR(i,n) RFOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = INT_MAX;
const LL LINF = LLONG_MAX;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

VI dx = {1,0,-1,0};
VI dy = {0,1,0,-1};

LL Gcd(LL a, LL b) {
  return __gcd(a,b);
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}


LL RepSqu(LL N, LL P, LL M) {
  if(P == 0) {
    return 1;
  }
  if(P%2 == 0) {
    LL t = RepSqu(N, P/2, M);
    return t*t % M;
  }
  return (N * RepSqu(N, P-1, M)) % M;
}


int main() {
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N, T;
  cin >> N >> T;
  
  LL ans=0;
  
  int t;
  
  
  LL a = 0, b = 0;
  
  REP(i,N){
    cin >> t;
    if(t >= b){
      ans += T;
    }else{
      ans += t-a;
    }
    a = t;
    b = a+T;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 384
a, b, c = map(int, input().split())
d = {}
for i in range(a, a+c):
    d[i] = 1
    if i == b:
        break
for i in range(b, b-c, -1):
    d[i] = 1
    if i == a:
        break
d = sorted(d.items())
for i, j in d:
    print(i)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
using namespace std;


int main() 
{
	int n, b[100],a[101];

	long long int num = 0;
	cin >> n;
	for (int i = 0; i < n - 1; i++)
		cin >> b[i];

	a[0] = a[1] = b[0];
	for (int i = 1; i < n - 1; i++)
	{
		if (b[i] < a[i])
		{
			a[i] = b[i];
		}
		a[i+1] = b[i];
	}
	for (int i = 0; i < n; i++)
		num += a[i];

	cout << num << endl;

	return 0;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  long long n;
  scanf("%lld", &n);
  long long k;
  scanf("%lld", &k);

  ll c = min(n, k - 1);
  double under = double(c) / double(n);
  double ans = 1 - under;

  rep(i, 1, c + 1) {
    double a = double(k) / double(i);
    double count = ceil(log2(a));
    ans += (1 / double(n)) * pow(0.5, count);
  }

  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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;
}

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 512
#include<stdio.h>
int main(){
  
	int N;
	scanf("%d", &N);
	if (N<10){
		printf("%d", N);
		return 0;
	}
	if(N>=10 &&N<100){
		printf("9");
		return 0;
	}

	if(N>=100 && 1000>N){
		printf("%d", 9 + N - 99);
		return 0;
	}

	if(N>=1000 && 10000>N){
		printf("909");
		return 0;
	}

	if(N>=10000 && 100000>N){
		printf("%d",909 + N - 9999);
		return 0;
	}

	if(N==100000){
		printf("90909");
		return 0;
	}

	return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int n, bit = 4;
int a[3];
int l[8];
int which[8];
int ans = inf;
void dfs(int now) {
    if (now == n) {
        // 処理
        pii tmp[3]; fill_n(tmp, 3, pii(0, 0));
        rep(i, n) {
            if (which[i] == 3) continue;
            tmp[which[i]].F += l[i];
            tmp[which[i]].S++;
        }
        int res = 0;
        rep(i, 3) {
            if (tmp[i].S == 0) return;
            res += (tmp[i].S - 1) * 10;
            res += abs(tmp[i].F - a[i]);
        }
        chmin(ans, res);
         
         //
        return;
    }
    rep(i, bit) {
        which[now] = i;
        dfs(now + 1);
    }
}
int main() {
    cin >> n;
    rep(i, 3) cin >> a[i];
    rep(i, n) cin >> l[i];
    dfs(0);
    out(ans);
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line.strip())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (d, t, s) = [int(e) for e in lines[0].split(" ")]
    

    return (d, t, s)


def solve(d, t, s):

    tmp = d / s 
    result = 'No'
    if tmp <= t:
        result = 'Yes'


    return result
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
	

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

using namespace std;

int main() {
  int n;
  std::cin >> n;
  std::vector<int> as(n - 1);
  for (auto& a : as) {
    std::cin >> a;
  }
  int aa;
  std::cin >> aa;
  std::cout << aa;
  if (n == 1) {
    return 0;
  }

  auto bItr = as.end() - 1;
  auto flag = true;
  for (auto aItr = as.rbegin() + 1; aItr != as.rend(); aItr++, flag = !flag) {
    if (flag) {
      std::cout << " " << (*aItr);
    } else {
      (*(--bItr)) = (*aItr);
    }
  }
  for (; bItr != as.end(); bItr++) {
    std::cout << " " << (*bItr);
  }
  std::cout << std::endl;
  return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int ans = Math.min(A, B) + Math.min(C, D);
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 21844
N=int(input())
S=input()

def f(SW,ox,prev):
  if SW=='S':
    if ox == 'o':
      if prev=='S': return 'S'
      else: return 'W'
    else:
      if prev=='S': return 'W'
      else: return 'S'
  else:
    if ox == 'o':
      if prev=='S': return 'W'
      else: return 'S'
    else:
      if prev=='S': return 'S'
      else: return 'W'

combination=[('S','S'),('S','W'),('W','S'),('W','W')]
ok=0
for j in range(4):
  if ok==1:break
  ans=[]
  for i in range(N):
    if i == 0:
      first,last = combination[j]
      ans.append(first)
      now = first
      next_ = f(now,S[i],last)
      continue
    if i == N-1:
      if last == next_ and first==f(next_,S[i],ans[-1]):
        ok=1
        ans.append(next_)
        break
      else:break
    ans.append(next_)
    next_ = f(next_,S[i],ans[-2])
    
if ok==1:
  print(''.join(ans))
else:
  print(-1)

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

using namespace std;

#define MOD 1000000007
#define ll long long int
#define ld long double
#define pb push_back
#define mkp make_pair
#define pii pair<int, int> 
#define pll pair<long long int, long long int>
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define fi first
#define sc second
#define deb 0

ll A[100];

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

	ll n, i, j, k;

	cin >> n;
	if (n <= 50) {
		cout << 50 <<  endl;
		for (i = 50; i > 0 && n; i--, n--) {
			A[i] = i;
		}
		for (i = 1; i <= 50; ++i) {
			cout << A[i] << " ";
		}
		cout << endl;
		return 0;
	}

	ll x, y;

	x = n / 50;
	y = n % 50;

	x--;

	for (i = 1; i <= 50; ++i) {
		A[i] = i + x;
	}

	for (i = 50; i > 0 && y; i--, y--) {
		A[i]++;
	}

	cout << 50 << endl;
	for (i = 1; i <= 50; ++i) {
		cout << A[i] << " ";
	} cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <cstdio>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <chrono>
#include <functional>

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

namespace atcoder {
	void judge_outer(bool judge_exp, string ok = "Yes", string ng = "No")
	{
		if (judge_exp) {
			cout << ok << endl;
		}
		else {
			cout << ng << endl;
		}
	}

	int ncr(int left, int right)
	{
		right = min(left - right, right);
		int ans = 1;
		for (int i = 1; i <= right; i++) {
			ans = ans * (left - right + i) / i;
		}
		return ans;
	}

	const int LIMIT = 1000000256;
	const int tenfive = 100100;
}

using namespace atcoder;

int main()
{
	int N,S;
	cin >> N >> S;
	vector<int> numlet(N);
	vector<int> checkmodlet(N);
	for (int i = 0; i < N; i++) {
		cin >> numlet[i];
		checkmodlet[i] = abs(numlet[i] - S);
	}
	int minimum = *(min_element(checkmodlet.begin(), checkmodlet.end()));
	for (int i = minimum; i > 0; i--) {
		if (minimum % i != 0)
			continue;
		if (all_of(checkmodlet.begin(), checkmodlet.end(), [i](int x) {return x % i == 0; })) {
			cout << i << endl;
			return 0;
		}
	}
	cout << 1 << endl;
	return 0;
}

Measured memory_bytes: 1024
use std::io::*;
use std::str::*;
use std::f64::consts::*;
use std::f64;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

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

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

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

fn main() {
    input!{
        n: i32,
        m: i32,
        a: [[i32; m]; n],
        b: [i32; m],
    }
    let mut tmp = 0;
    for i in 0..n {
        let s = &a[i as usize];
        tmp = 0;
        for j in 0..m {
            tmp += s[j as usize] * b[j as usize];
        }
        println!("{}", tmp);
    }
}


Measured memory_bytes: 5036
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int n;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	for(Int i=1; i<=9; ++i){
		Int j = n / i;
		if(i * j == n && 1 <= j && j <= 9){
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>

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

signed main() {
	int n;
	std::cin >> n;
	std::vector<std::vector<int>> g(n);
	std::vector<int> in(n, 0);
	REP(i, n) {
		int u, v;
		std::cin >> u >> v;
		--u; --v;
		g[u].emplace_back(v);
		g[v].emplace_back(u);
		++in[u];
		++in[v];
	}
	std::queue<int> que;
	REP(i, n) if (in[i] == 1) que.push(i);
	std::vector<bool> cycle(n, true);
	while (!que.empty()) {
		int now = que.front(); que.pop();
		cycle[now] = false;
		for (auto& to : g[now]) {
			if (--in[to] == 1) {
				que.push(to);
			}
		}
	}

	int Q;
	std::cin >> Q;
	REP(_, Q) {
		int a, b;
		std::cin >> a >> b;
		--a; --b;
		int res = 1;
		if (cycle[a] && cycle[b]) ++res;
		std::cout << res << std::endl;
	}
}


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

int main() {
    
    // 'a' = 97
    string S;
    cin >> S;
    int V = 26; // アルファベットの総数
    int num[V] = {0};

    for(int i = 0; i < S.length(); ++i) {
        ++num[S[i] - 'a'];
    }
    for(int i = 0; i < V ; ++i ) {
        
        if(num[i] == 0) {
            cout << char(i+'a') << endl;
            exit(0);
        }
    }
    cout << "None" << endl;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N,Q;
    string S;
    cin>>N>>Q>>S;
    vi counter(N);
    counter[0]=0;
    int c=0;
    for(int i=1; i<N; i++) {
        if(S[i-1]=='A'&&S[i]=='C') c++;
        counter[i]=c;
    }
    while(Q--) {
        int l,r;
        cin>>l>>r;
        cout<<counter[r-1]-counter[l-1]<<endl;
    }
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




int main() {
  ll n,m;
  string s,t;
  cin>>n>>m>>s>>t;
  
  ll g=gcd(n,m);
  ll nn=n/g;
  ll mm=m/g;

  bool ok=true;
  rep(i,g){
    if(s[nn*i]!=t[mm*i])ok=false;
  }

cout << (ok?lcm(n,m):-1) << endl;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, l;
    cin >> n >> l;
    vector<string> v(n);
    REP(i,n) cin >> v[i];

    sort(ALL(v));
    REP(i,n) cout << v[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
//typedef LL int;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    int n;
    cin >> n;
    if(n == 9 || n/10 == 9 || n % 10 == 9) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

data = [[] for i in range(n)]

for i in range(m):
    p, y = list(map(int, input().split()))
    data[p-1].append((y, i))

ans = [0 for i in range(m)]
for i in range(n):
    data[i].sort()
    for j in range(len(data[i])):
        _id = "0"*(6-len(str(i+1)))+str(i+1)+"0"*(6-len(str(j+1)))+str(j+1)
        ans[data[i][j][1]] = _id

for i in range(m):
    print(ans[i])

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  // あるAの倍数はBで割ったときCとなるか
  int A, B, C; cin >> A >> B >> C;
  rep(i, 10000) {
    if ((i + 1) * A % B == C) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
}


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

using namespace std;
#define n_max 10000
#define INF 10001000

#define rep(i, a, n) for(int i = a; i < n; i++)
#define rep2(i, a, n) for(int i = a; i <= n; i++)
#define rrep(i, a, n) for(int i = a; i > n; i--)
#define rrep2(i, a, n) for(int i = a; i >= n; i--)
#define lrep(i, a, n) for(long int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

int main()
{
    int N;
    ll pre = 0;

    cin >> N;
    ll H[N]; 

    rep(i, 0, N) {
        cin >> H[i];
    }
    
    pre = H[0]-1;
    rep(i, 1, N) {
        if(H[i] == pre) { continue; } 
        else if(H[i] >= pre + 1) { pre = H[i] - 1; }
        else { cout << "No" << endl; return 0;} 
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1024
n=int(input())
m=0
a=0
r=0
c=0
h=0
for i in range(n):
    s=input()
    if s[0]=='M':
        m+=1
    elif s[0]=='A':
        a+=1
    elif s[0]=='R':
        r+=1
    elif s[0]=='C':
        c+=1
    elif s[0]=='H':
        h+=1
ans=0

ans+=m*a*r
ans+=m*a*c
ans+=m*a*h
ans+=m*r*c
ans+=m*r*h
ans+=m*c*h

ans+=a*r*c
ans+=a*r*h
ans+=a*c*h

ans+=r*c*h

print(ans)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
#define bool    _Bool
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }



int main() {
	int X;
	scanf("%d", &X);
	int i;
	for (i = 0; i*(i + 1) / 2 < X; i++) {
	}
	printf("%d\n", i);





#ifdef DEBUGF
	getch();
#endif
	return 0;
	}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

const ll MOD = ll(1e9) + 7;
int main(void)
{
    cin.sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    vector<ll> As(N);
    REP(n, N) cin >> As[n];

    ll c = (K - 1) * K / 2;
    c %= MOD;

    vector<ll> num(N);
    vector<ll> seen;
    for(int i = N - 1; i >= 0; --i) {
        auto a = As[i];
        auto it = lower_bound(ALL(seen), a);
        num[i] = it - seen.begin();
        seen.insert(it, a);
    }

    vector<ll> num2(N);
    REP(i, N) {
        num2[i] = lower_bound(ALL(seen), As[i]) - seen.begin();
    }

    ll ans = 0;
    REP(i, N) {
        auto add1 = c * num2[i];
        auto add2 = num[i] * K;

        auto add = add1 + add2;
        add %= MOD;

        ans += add;
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;

int main() {
    int a, b; cin >> a >> b;
    if (a > 9 || b > 9) {
        cout << "-1"; return 0;
    }
    cout << (int)(a*b);

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "hon";
            string sLst = sS.Substring(sS.Length - 1);
            if (sLst == "0" || sLst == "1" || sLst == "6" || sLst == "8") { sOut = "pon"; }
            else if (sLst == "3") { sOut = "bon"; }

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 25960
#include <bits/stdc++.h>
#include <stdio.h>
#include <ctype.h>
#pragma GCC optimize ("Ofast")

#define repk(i,a,b) for(int i=(a);i<=(b);++i)
#define FOR(i,n)  for(int i=0;i<=(n);++i)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define for1(i,n)  for(int i=1;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
#define ll long long
#define ld long double
#define point pair<double,double>
#define pii pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
const int  inf = INT_MAX;
const int MOD = 1000000007;
const int N = 100100;

using namespace std;


void sol() {

	int x; cin >> x;
	cout << (360 / __gcd(x, 360));
}



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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1; // cin >> t;
	while (t--)
		sol();
	return 0;
}

Measured memory_bytes: 3504
from collections import Counter

def main():
    S = input()
    T = input()
    cnt_S = []
    cnt_T = []
    for i, j in Counter(S).items():
        cnt_S.append(j)
    for i, j in Counter(T).items():
        cnt_T.append(j)

    cnt_S.sort()
    cnt_T.sort()
    if cnt_T == cnt_S:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Measured memory_bytes: 74352