akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
 
int main(){
  int n;
  cin>>n;
  map<int,int> mp;
  rep(i,n){
    int p;
    cin>>p;
    mp[p-1]++; mp[p]++; mp[p+1]++;
  }
  int ans=0;
  for(auto x:mp){
    ans=max(ans,x.second);
  }
  cout<<ans<<endl;
}


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

A = [0]
A.extend(map(int, input().split()))
A.append(0)

S = 0
for i in range(N+2):
  if i+1 == N+2:
    continue
  S += abs(A[i+1] - A[i])
  
for i in range(1, N+1):
  tmp = S
  x = abs(A[i+1] - A[i-1])
  y = abs(A[i+1] - A[i]) + abs(A[i] - A[i-1])
  tmp -= y-x
  print(tmp)

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

int main(){
    int n;
    cin >> n;
    map<string, int> data;
    int i;
    for(i = 0; i < n; i++){
        string s;
        cin >> s;
        data[s] += 1;
    }
    int max = 0;
    for(auto p : data){
        if(p.second > max){
            max = p.second;
        }
    }
    for(auto p : data){
        if(p.second == max){
            cout << p.first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
bitset < 2000 * 1000 + 10 > p;
int n;
int s;
int main() {
    cin >> n;
    p[0] = 1;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        s += x;
        p = p | (p << x);
    }
    for (int i = s / 2; ; i--) {
        if (p[i] == 1) {
            cout << s - i;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;
    string S;
    cin >> S;
    vector<int> ans;

    int now = N;
    while (now > 0) {
        int t_now = max(now - M, 0);
        // cout << now << " t_now:" << t_now << endl;
        while (t_now < now) {
            if (S[t_now] == '0') {
                break;
            }
            t_now++;
        }
        if (t_now == now) {
            cout << "-1" << endl;
            return 0;
        } else {
            ans.push_back(now - t_now);
            now = t_now;
        }
    }
    reverse(ALL(ans));
    for (auto i : ans) {
        cout << i << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1144
n=int(input())
s=input()
ans=0
for i in range(1000,2000):
    templ=list(str(i))
    t=templ[1:]
    #print(t)
    p=0
    for q in range(n):
        if s[q]==t[p]:
            p+=1
        if p>2:
            ans+=1
            break         

print(ans)


Measured memory_bytes: 41180
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

int main() {
	int N;

	cin >> N;

	int f = 0;
	int n = N;
	while (n) {
		f += n % 10;
		n /= 10;
	}

	if (N % f == 0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#define int long long
//#define _DEBUG
//#include <utility>
#include <vector>
#include <string>
using namespace std;
struct edge{
    int start;
    int end;
    int cost;
};
int V, E, r, T[500007];
vector<edge> Vs;
int const infty = 2147483647;
void solve(){
    for(int t=0; t<V; t++){
        bool updated = false;
        for(int i=0; i<E; i++){
            if(T[Vs[i].start]<infty &&
                    T[Vs[i].start]+Vs[i].cost < T[Vs[i].end]){
                T[Vs[i].end] = T[Vs[i].start]+Vs[i].cost;
                updated = true;
            }
        }
        if(!updated) break;
    }
}
bool get(){
    if(cin >> V >> E >> r && V>0){
        for(int i=0; i<V; i++){
            T[i] = infty;
        }
        T[r] = 0;
        Vs.clear();
        for(int i=0; i<E; i++){
            edge v;
            cin >> v.start >> v.end >> v.cost;
            Vs.push_back(v);
        }
        return true;
    } else return false;
}

signed main(){
    while(get()){
#ifdef _DEBUG
        for(int i=0; i<V; i++){
            cout <<Vs[i].start<<","<<Vs[i].end<<","<<Vs[i].cost<<endl;
        }
#endif
        solve();
        for(int i=0; i<V; i++){
            cout << (T[i]==infty? "INF": to_string(T[i])) << endl;
        }
    }
}


Measured memory_bytes: 9552
#include <bits/stdc++.h>
using namespace std;
const int N = 305, M = 998244353;
int dp[N][N][N];
vector<int> a;
int k;

int solve(int x, int cur, int rem) {
  if (cur > k || rem < 0) return 0;
  if (x == -1) return (rem == 0);

  int &ret = dp[x][cur][rem];
  if (~ret) return ret;
  ret = 0;

  for (int i = 0; i <= a[x]; ++i) {
    ret = (ret + solve(x - 1, cur + i, rem + i)) % M;
  }
  for (int i = 1; i <= rem; ++i) {
    ret = (ret + solve(x - 1, cur, rem - i)) % M;
  }
  return ret;
}


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

  string s;
  cin >> s >> k;

  memset(dp, -1, sizeof dp);
  a.push_back(0);
  for (auto i : s) {
    if (i == '0') a.push_back(0);
    else a.back()++;
  }

  cout << solve((int)a.size() - 1, 0, 0) << '\n';
}


Measured memory_bytes: 114472
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	string a, s, c;
	cin >> a >> s >> c;

	cout << 'A' << s[0] << 'C' << endl;
	return 0;
}


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

using namespace std;
#define endl "\n"
#define FILEIO freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define LL long long 
#define mod 1000000007LL
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back
//#define p push
#define I insert
#define bg begin()
#define ed end()
#define sz size()
#define all(v) v.begin(),v.end()
typedef vector<LL> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef map<LL ,LL > mii;
//typedef priority_queue<int> pq;
typedef queue<int>que;
typedef stack<int>stk;
#define Inf 100000005LL
#define f first
#define s second





vi vect_2pow;
void pow_of_2(){
    vect_2pow.assign(32,0);
      for(int i=0;i<=32;i++){
           LL y = 1<<i;
           vect_2pow[i]=y;
      }
}
bool Ispalindrome(string str){
        LL len = str.size();
		bool flag;
		for(int i=0;i<len/2;i++){
				if(str[i]==str[len-i-1])
				     {
						 flag=0;
						 continue;
					 }
					 else 
					    {
							flag=1;
							break;
						}
			}
		if (flag==1)
		  return false;
		else return true;  
		
}
vector<LL> prime_check;
mii get_high_prime;
int high_prime_factor(){
	//cout<<"ecd";
	LL max_prime=0;
	for(int i=2;i<100000;i++)
	{
		LL n=i;
		
		while(n%2==0)
		{
			max_prime=2;
			n>>=1;
		}
		for(int j=3;j<=sqrt(n);j++)
		{
			while(n%j==0){
				max_prime=j;
				n/=j;
			}
		}
		if(n>2)
		  max_prime=n;
		  
		//prime_check.pb(max_prime);
		get_high_prime[i]=max_prime;
	}
	
			
}
int main()
{
	string str1;
	cin>>str1;
	bool flag=0;
	for(auto x: str1)
	   {
		   if(x=='7')
		      {
				  flag=1;
				  break;
			  }
	   }
	   if(flag==1)
	      cout<<"Yes\n";
		else
		{
			cout<<"No\n";
		}
		  

}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)((x).size())
#define mp make_pair

using namespace std;

typedef unsigned long long ull;
typedef pair<int,int> ii;

template<class U,class T>ostream& operator<<(ostream& out, pair<U,T> & P){
    return out << "[" << P.first << ", " << P.second << "]";
}
template<class T>ostream& operator<<(ostream& out, vector<T> & V){
    if(!V.empty())out << "[";
    for(int i = 0; i < sz(V); i++)out << V[i] << (i+1==sz(V)?"]":", ");
    return out;
}

int main(){
    ios_base::sync_with_stdio(false);
    long long A[10][10] {}, N, res = 0;
    memset(A,0,sizeof A);
    cin >> N;
    for(int i = 1; i <= N; i++){
        int l = i%10, f = i;
        while(f>=10)f/=10;
        A[f][l] += 1;
    }
    for(int i = 1; i <= N; i++){
        int l = i%10, f = i;
        while(f>=10)f/=10;
        res+=A[l][f];
    }
    cout << res << endl;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  
  for (int i = -2; i < w; i++) {
    cout << '#';
  }
  cout << endl;
  
  for (int i = 0; i < h; i++) {
    cout << '#';
    vector<char> ah(w);
    for (int j = 0; j < w; j++) {
      cin >> ah.at(j);
      cout << ah.at(j);
    }
    cout << '#' << endl;
  }
  
  for (int i = -2; i < w; i++) {
    cout << '#';
  }
  cout << endl;  
}



Measured memory_bytes: 256
#include <stdio.h>

int heap[255];

int parent(int i) {
    return i/2;
}

int left(int i) {
    return 2*i;
}

int right(int i) {
    return 2*i+1;
}

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

	for(i = 1 ; i <= n ; i++) {
		scanf("%d", &heap[i]);
	}

	for(i = 1 ; i <= n ; i++) {
		int r, l;
		printf("node %d: key = %d,", i, heap[i]);
		if(i > 1) {
			printf(" parent key = %d,",heap[parent(i)]);
		}
		l = left(i);
		r = right(i);
		if(l <= n) printf(" left key = %d,", heap[l]);
		if(r <= n) printf(" right key = %d,", heap[r]);
		printf(" \n");
	}

	return 0;
}



Measured memory_bytes: 2068
#include <bits/stdc++.h>
using namespace std;
#define FOR(x) for(int i=0; i<n; i++)
#define M_PI 3.14159265358979323846
#define MOD 1000000007
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> ipair;
typedef pair<ll, ll> llpair;

int h, w, k;
string a[6];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    cin>>h>>w>>k;
    for(int i=0; i<h; i++){
        cin>>a[i];
    }
    int ans=0;
    for(int maskr=0; maskr<(1<<h); maskr++){
        for(int maskc=0; maskc<(1<<w); maskc++){
            int blk = 0;
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    if((maskr>>i)&1 and (maskc>>j)&1 and a[i][j]=='#') blk++;
                }
            }
            if(blk==k) ans++;
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	for(int i=0,num[3],ans;i<n;i++){
		for(int j=0;j<3;j++){
			cin>>num[j];
			if(j!=2)num[j]--;
		}
		if((num[0]+1)%3==0)ans=num[1]*20;
		else ans=num[1]/2*39+num[1]%2*20;
		cout<<196471-ans-num[0]/3*590-num[0]%3*195-num[2]<<endl;
	}
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>

using namespace std;

void commonSeq(){
    string seq1, seq2;
    cin >> seq1;
    cin >> seq2;
    int nrow = seq1.length() + 1;
    int ncol = seq2.length() + 1;
    vector< vector<int> > dpmat;
    dpmat = vector< vector<int> >(nrow, vector<int>(ncol, 0));
    for(int i = 0; i < nrow; i++){
        dpmat[i][0] = 0;
    }
    for(int j = 0; j < ncol; j++){
        dpmat[0][j] = 0;
    }

    for(int i = 1; i < nrow; i++){
        for(int j = 1; j < ncol; j++){
            dpmat[i][j] = max(max(dpmat[i-1][j-1] + (seq1[i-1] == seq2[j-1]), dpmat[i-1][j]), dpmat[i][j-1]);
        }
    }
    printf("%d\n", dpmat[nrow-1][ncol-1]);
}

int main(){
    int n; 
    cin >> n;
    for(int i = 0; i < n; i++){
        commonSeq();
    }
    return 0;
}


Measured memory_bytes: 10832
#include<stdio.h>
int main()
{
    char x,y;
    scanf("%x%x",&x,&y);

    if (x<y)
    {
        printf("<");

    }

        else if (x>y)
        {
            printf(">");
        }

        else if (x==y)
        {
            printf("=");
        }
        return 0;

    }





Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}
 
void solve() {
    int h, w;
    cin >> h >> w;
    vector<string> g(h);
    REP(i, h) cin >> g[i];
    vector<vector<int>> dp(h, vector<int>(w, 0));
    dp[0][0] = 1;

    REP(i, h) REP(j, w) {
        if (i == 0 && j == 0) continue;
        if (i != 0 && g[i - 1][j] == '.') dp[i][j] += dp[i - 1][j];
        dp[i][j] %= MOD;
        if (j != 0 && g[i][j - 1] == '.') dp[i][j] += dp[i][j - 1];
        dp[i][j] %= MOD;
    }
    cout << dp[h - 1][w - 1] << EOL;
}


Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <math.h>
#include <algorithm>
#include <queue>

using namespace std;

const double PI=3.14159265358979323846;
int main()
{
    double R;

    cin >> R;

    printf("%f\n", (2 * R * PI));
    
    return 0;
}


Measured memory_bytes: 3788
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

S=input()
s=len(S)
T=input()
t=len(T)
ans='UNRESTORABLE'
if s<t:
    print(ans)
    exit()
for i in range(s-t,-1,-1):
    for j in range(t):
        tmp=True
        if S[i+j] not in ['?',T[j]]:
            tmp=False
            break
    if tmp:
        print(S[:i].replace('?','a'),end='')
        print(T,end='')
        print(S[i+t:].replace('?','a'))
        exit()
print(ans)

Measured memory_bytes: 69340
from itertools import chain,combinations
import numpy as np


# From: https://qiita.com/hrsma2i/items/d98f9b1fceeb23d67eef
def powerset(iterable):
    "powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))


def main():
    n, m = [int(val) for val in input().split()]
    vectors_for_each_switch = [[] for _ in range(n)]
    for light_id in range(m):
        k_and_ss = [int(val) for val in input().split()]
        k = k_and_ss[0]
        if k == 0:
            switches = []
        else:
            switches = k_and_ss[1:]
        switches = [switch - 1 for switch in switches]
        switches = set(switches)
        for switch_id in range(n):
            is_in = switch_id in switches
            vectors_for_each_switch[switch_id].append(is_in)

    vectors_for_each_switch = [np.asarray(vec, dtype=int) for vec in vectors_for_each_switch]
    target_vector = np.asarray([int(val) for val in input().split()], dtype=int)

    count = 0
    for switch_set in powerset(range(n)):
        target = target_vector
        for on_switch in switch_set:
            target = target + vectors_for_each_switch[on_switch]
        if all(target % 2 == 0):
            count += 1
    print(count)


if __name__ == '__main__':
    main()

Measured memory_bytes: 12172
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#include <assert.h>
#include <numeric>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)(1e5)
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){fast;
	string a[]={"AC","WA","TLE","RE"};vi b(4,0);
	map<string,int>mp;for(int i=0;i<4;i++) mp[a[i]]=i;
	int n,i;string x;cin>>n;for(i=0;i<n;i++) cin>>x,b[mp[x]]++;
	for(i=0;i<4;i++) cout<<a[i]<<" x "<<b[i]<<endl;
}


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

int main() {
    ll n, k;
    cin >> n >> k;
    vector<ll> p(n), c(n);
    rep(i, n)cin >> p[i];
    rep(i, n)p[i]--;
    rep(i, n)cin >> c[i];

    ll INF = 1001001001001001001;
    ll ans = -INF;
    rep(i, n){
        
        vector<ll> cnt(n, INF);
        int idx = p[i];
        cnt[idx] = c[idx];
        int num = 1;
        while(idx != i){
            ll sum = cnt[idx];
            idx = p[idx];
            cnt[idx] = sum + c[idx];
            num++;
        }
        ll score = 0;
        ll kk = k;
        if(cnt[i] > 0){
            ll m = max(0LL, kk / num - 1);
            score += m * cnt[i];
            kk -= m * num;
        }else{
            if(kk % num == 0)kk = num;
            else{
                if(kk >= num)kk = num;
            }
        }

        ll mx = -INF;
        idx = i;
        rep(j, kk){
            idx = p[idx];
            if(j < num)mx = max(mx, cnt[idx]);
            else mx = max(mx, cnt[idx] + cnt[i]);
        }
        if(kk > 0)score += mx;
        ans = max(ans, score);
    }
    cout << ans << endl;
}

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



int main(){
    int A,B;
    vector <int> vec(3);
    cin >> A >> B;
    vec[0] = A + B;
    vec[1] = A - B;
    vec[2] = A * B;
    cout << *max_element(vec.begin(),vec.end()) << endl;
    return 0;
}


Measured memory_bytes: 256
A, B, C = [int(i) for i in input().split()]

memo = 0
mods = []
i = 1
while True:
    memo = memo + A
    r = memo % B
    if r == C:
        flag = True
        break
    elif r in mods:
        flag = False
        break
    else :
        mods.append(r)
        i += 1
        
if flag:
    print('YES')
else :
    print('NO')

Measured memory_bytes: 3064
n = int(input())
st = {}
for i in range(0,n):
    si = input()
    if si in st:
        st[si] += 1
    else:
        st[si] = 1
m = int(input())
for i in range(0,m):
    ti = input()
    if ti in st:
        st[ti] -= 1
    else:
        st[ti] = -1
stlist = list(st.items())
stlist.sort(key=lambda x:x[1])
stlist.reverse()
print(max(stlist[0][1],0))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define M 1000000007
using namespace std;
signed main()
{
	fast
	
	int n;
	cin>>n;
	int a[n],sum=0;
	for(int i=0;i<n;i++)
		cin>>a[i];
	
	for(int i=0;i<n-1;i++)
	{
		if(a[i]>a[i+1])
		{
			sum+=a[i]-a[i+1];
			a[i+1]=a[i];
		}
		
	}
	cout<<sum<<endl;
}

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

typedef std::pair<int, int> pii;   

int n, m, i, j, k, L, cntE;
std::vector<pii> gra[70];

inline void adde(int u, int v, int w) {
  gra[u].push_back(std::make_pair(v, w));  
  cntE++;    
}

int main() {
  scanf("%d", &L);
  int cntV = 0, _L = L;
  while (_L) {
    cntV++;
    _L >>= 1;
  }
  for (int i = 1; i < cntV; i++) {
    adde(i, i + 1, 0);
    adde(i, i + 1, 1 << (cntV - i - 1));
  }
  int sum = 1 << (cntV - 1);
  for (int i = cntV - 1; i >= 1; i--) {
    if (L & (1 << (i - 1))) {
      adde(1, cntV - i + 1, sum);
      sum += 1 << (i - 1);
    }
  }
  printf("%d %d\n", cntV, cntE);
  for (int i = 1; i <= cntV; i++) {
    for (pii E : gra[i]) {
      printf("%d %d %d\n", i, E.first, E.second);
    }
  }
  return 0;     
}

Measured memory_bytes: 3836
#include<fstream>
#include<sstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<utility>
#include<cctype>
using namespace std;

#define ull unsigned long long
#define stt(it,order) sort(it.begin(),it.end(),order)
#define st(it) sort(it.begin(),it.end())
#define ll long long
#define rep(i,j) for(int i=0;i<j;++i)
#define loop(i,a,j) for(int i=a;i<j;++i)
#define mpi(it,table,T,E) for(map<T,E>::iterator it = table.begin();it!=table.end();++it)
#define PI 3.141592654
/*
ifstream fin("input.txt");
ofstream fout("output.txt");
#define cin fin
#define cout fout
*/

int main(){
   int c = 0,j;
   while(scanf("%d",&j) != EOF) c += j;
   printf("%d\n",c);
   return 0;
}

Measured memory_bytes: 1028
//
//AtCoder Beginner Contest 134
//C - Exception Handling
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    pair<int,int> a[n];
    REP(i, n) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a, a+n, greater<pair<int, int>>());

    REP(i,n){
        //cout << a[i].first << " " << a[i].second << endl;
        REP(j,n){
            if (a[j].second != i) {
                cout << a[j].first <<endl; 
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 1000003
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#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 sumall(v) accumulate(all(v),(ll)0)
#define sum accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::floatfield );std::cout.precision(15)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define br "\n"
#define sp " "
#define zero (ll)0
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v , ll a = 0)
{
    //ll a ;
    for(ll i=a ; i<v.size() ; i=i+1)
    {
        v[i] = max((ll)0,v[i]);
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
/*vbool isprime(N,true);
vll spf(N,0);
vll prime;
void sieve()
{
    isprime[0] = isprime[1] = false;
    for(ll i = 2 ; i<N ; i++)
    {
        if(isprime[i])
        {
            for(ll j=2*i ; j<N ; j+=i)
            {
                isprime[j] = false;
                if(spf[j]==0)
                {
                    spf[j] = i;
                }
            }
            prime.pb(i);
        }
    }
}*//*
ll nck(ll n , ll k ,ll m=1e18+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}*//*
long long power(long long k , long long n , long long m=mod)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}*/
ll n,m,k,l,r;
bool ok = false;
int main()
{
    FastIO ;
    PRECISION ;
    ll a,b,c,d,i,j,t,x,y,z;//,x1,y1,z1,e,f;
    ll p,q,r,u,w ;
    char ch,chr ;
    string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    cin>>n;
    map<string,ll>mp;
    for(i=0 ; i<n ; i++)
    {
        cin>>str;
        mp[str]++;
    }
    cout<<sz(mp);
}

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

int main() {
   int t, x;
   cin >> t >> x;

   cout << (double)t / x << endl;
}

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


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n,q;
    cin>>n>>q;
    int x,y,z;
    
    dsu uf(n);
    rep(i,q){
        cin>>x>>y>>z;
        if(x) cout<<uf.same(y,z)<<endl;
        else  uf.merge(y,z);
    }

}/*
./problem.exe
*/

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

#define lld long long
#define pi pair<int, int>
#define pl pair<lld, lld>
#define mem0(x) memset(x, 0, sizeof(x))
#define fillnum(x, n) fill(begin(x), end(x), n)
#define asort(x) sort(x.begin(), x.end())
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>())

int main() {
    lld A, B, C, K;
    cin >> A >> B >> C >> K;
    lld ans = 0;
    lld nK = K;
    lld tmp;
    tmp = min(A, nK);
    nK -= tmp;
    ans += tmp;
    tmp = min(B, nK);
    nK -= tmp;
    tmp = min(C, nK);
    nK -= tmp;
    ans -= tmp;
    cout << ans << endl;
}

Measured memory_bytes: 3636
import itertools


n_bamboo, b1, b2, b3 = [int(i) for i in input().split()]
bamboos = [int(input()) for _ in range(n_bamboo)]

ans = float("inf")
# すべての竹について、b1, b2, b3のどの竹に使うかを列挙
# 0のときはどの竹にも使わない
for bit in itertools.product((0, 1, 2, 3), repeat=n_bamboo):
    l1, l2, l3 = 0, 0, 0
    c1, c2, c3 = 0, 0, 0
    # 選択した竹を足す（2つ目以降はMP10消費）
    for b, bamboo in zip(bit, bamboos):
        if b == 1:
            if l1 > 0:
                c1 += 10
            l1 += bamboo
        elif b == 2:
            if l2 > 0:
                c2 += 10
            l2 += bamboo
        elif b == 3:
            if l3 > 0:
                c3 += 10
            l3 += bamboo
    # 1つも構成する竹がない竹がある場合はスキップ
    if l1 * l2 * l3 == 0:
        continue
    # 延長、短縮のコスト
    c1 += abs(b1 - l1)
    c2 += abs(b2 - l2)
    c3 += abs(b3 - l3)
    # 合計コストが今までより低ければ更新
    ans = min(ans, c1 + c2 + c3)
print(ans)


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

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

  vector<int> vec;
  int sum = 1;
  for (int i = 1; i < n; i ++) {
    if (s[i] != s[i-1]) {
      vec.push_back(sum);
      sum = 0;
    }
    sum ++;
  }
  vec.push_back(sum);
  if (s[0] == '0') vec.insert(vec.begin(), 0);
  if (s[n-1] == '0') vec.push_back(0);

  vector<int> c(vec.size() + 1);
  for (int i = 1; i < c.size(); i ++) {
    c[i] = c[i-1] + vec[i-1];
  }

  int ansX = c[min(2*k+1, (int)c.size() - 1)];
  for (int i = 2*k+3; i < c.size(); i += 2) {
    int tmp = c[i] - c[i - 2*k - 1];
    ansX = max(ansX, tmp);
  }
  cout << ansX << endl;
  
  /*
  int ans = 0;
  for (int i = 0; i <= min(2*k, (int)vec.size()); i ++) ans += vec[i];

  int tmp = ans;
  int j = 0;
  for (int i = 2*k + 1; i < vec.size(); i += 2) {
    tmp = tmp + vec[i] + vec[i+1] - vec[j] - vec[j+1];
    j += 2;
    ans = max(ans, tmp);
  }

  cout << ans << endl;
  */
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define viii vector <pair<ll,pair<ll,ll> > >
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<" "
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define inf 999999999999999999
#define sp << " " <<
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);
#define sz size()

vi g[100005];

pair <ll,ll> dfs(ll id, ll p)
{
	ll w=1,b=1;
	fr(i,0,g[id].sz)
	{
		if(g[id][i]!=p)
		{
			pair <ll,ll> x=dfs(g[id][i],id);
			w=(w*(x.fi+x.se)%md)%md;
			b=(b*x.fi)%md;
		}
	}
	return mp(w,b);
}

int main()
{
	ll n;
	cin >> n;
	fr(i,1,n)
	{
		ll x,y;
		cin >> x >> y;
		g[x].pb(y);
		g[y].pb(x);
	}
	pair <ll,ll> p=dfs(1,-1);
	cout << (p.fi+p.se)%md;
}

Measured memory_bytes: 12672
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int P = 1e9 + 7;
const int MAXN = 5007;
const int MAXM = 1e4 + 7;
int n, ccnt, home[MAXN], nxt[MAXM], to[MAXM];

inline void ct(int x, int y) {
	ccnt++;
	nxt[ccnt] = home[x];
	home[x] = ccnt;
	to[ccnt] = y;
}

ll dp[MAXN][MAXN], t[MAXN], g[MAXN];
int siz[MAXN];

inline void add(ll &x, ll y) {
	x += y;
	if(x >= P)x -= P;
}

inline void dfs(int u, int F) {
	dp[u][1] = 1;
	siz[u] = 1;
	for(int i = home[u]; i; i = nxt[i]) {
		int v = to[i];
		if(v == F)continue;
		dfs(v, u);
		// printf("we are u%d v%d\n", u, v);
		for(int i = 1; i <= siz[u] + siz[v]; ++i)t[i] = 0;
		for(int i = 1; i <= siz[u]; ++i) {
			for(int j = 1; j <= siz[v]; ++j) {
				// printf("%d %d %d %d\n", i, j, dp[u][i], dp[v][j]);
				add(t[i], P - 1ll * dp[u][i] * dp[v][j] % P * g[j] % P);
				add(t[i + j], 1ll * dp[u][i] * dp[v][j] % P);
			}
		}
		// puts("finished");
		for(int i = 1; i <= siz[u] + siz[v]; ++i) {
			// printf("%d %d\n", i, t[i]);
			dp[u][i] = t[i];
		}
		siz[u] += siz[v];
	}
	// if(u != 1) {
	// 	dp[u][0] = 0;
	// 	for(int i = 1; i <= siz[u]; ++i) {
	// 		printf("%d %d?%d \n", i, dp[u][i], g[i]);
	// 		add(dp[u][0], 1ll * (P - dp[u][i]) * g[i] % P);
	// 	}
	// } else {
	// 	for(int i = 1; i <= siz[u]; ++i) {
	// 		add(dp[u][0], 1ll * dp[u][i]*g[i] % P);
	// 	}
	// }
	// for(int i = 0; i <= siz[u]; ++i) {
	// 	printf("we are in%d %d %d\n", u, i, dp[u][i]);
	// }
	return ;
}

inline void init() {
	g[2] = 1;
	for(int i = 4; i <= n; i += 2) {
		g[i] = 1ll * g[i - 2] * (i - 1) % P;
	}
	return ;
}

int main() {
	scanf("%d", &n);
	for(int i = 1, x, y; i < n; ++i) {
		scanf("%d%d", &x, &y);
		ct(x, y);
		ct(y, x);
	}
	init();
	dfs(1, 0);
	for(int i = 1; i <= siz[1]; ++i) {
		add(dp[1][0], 1ll * dp[1][i] * g[i] % P);
	}
	printf("%lld\n", dp[1][0]);
	return 0;
}

Measured memory_bytes: 92728
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-9
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	string S;
	scan(S);
	int flag=0;
	rep(i,S.size()){
		if(flag==0&&S[i]=='C') flag=1;
		else if(flag==1&&S[i]=='F') flag=2;
	}
	if(flag==2) prin("Yes");
	else prin("No");
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <climits>
#include <string>
#include <vector>

using namespace std;

int main () {
    int n = 0;
    cin >> n;
    vector<vector<long long>> ball(n, vector<long long>(2));
    for (int i=0; i<n; i++) {
        cin >> ball.at(i).at(0) >> ball.at(i).at(1);
    }
    vector<pair<vector<long long>, int>> count;
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            if (i == j) continue;
            vector<long long> buf(2);
            buf.at(0) = ball.at(i).at(0) - ball.at(j).at(0);  
            buf.at(1) = ball.at(i).at(1) - ball.at(j).at(1);
            bool find = false;
            for (int i=0; i<count.size(); i++) {
                if (count.at(i).first == buf) {
                    count.at(i).second++;
                    find = true;
                }
            }
            if (!find) {
                count.push_back(make_pair(buf, 1));
            }
        }
    }
    int ans = 0;
    for (pair<vector<long long>, int> a : count) {
        if (a.second > ans) ans = a.second;
    }
    cout << n - ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>

#define INF 2147483647

int main()
{
  int N;
  std::cin >> N;
  int min_P = INF;
  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    int P;
    std::cin >> P;
    if (min_P >= P)
    {
      ans++;
      min_P = P;
    }
  }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/lexical_cast.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define mp make_pair
#define endl '\n'
#define PI acos(-1)
#define P pair<int,int>
typedef tree<int,null_type,less_equal <int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

long mod=1e9+7;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q;
    cin>>q;
    multiset<int> s;
    int ans=0;
    int type;
    int a,b;
    cin>>type>>a>>b;
    s.insert(a);
    auto mid=s.begin();
    ans+=b;
    int cnt=1;
    --q;
    while(q--)
    {
   
    	cin>>type;
    	if(type==1)
    	{
    		cin>>a>>b;
    		if(cnt&1)
    		{
    			if(a>=*mid)
    			{
    				s.insert(a);
    				ans+=a-*mid;
    			}
    			else
    			{
    				s.insert(a);
    				ans+=*(mid)-a;
    				--mid;
    			}
    		}
    		else
    		{
    			if(a>=*mid)
    			{
    				s.insert(a);
    				++mid;
    				ans+=a-*mid;
    			}
    			else
    			{
    				s.insert(a);
    				ans+=*mid-a;
    			}
    		}
    		++cnt;
    		ans+=b;
    	}
    	else
    	{
    		cout<<*mid<<" "<<ans<<endl;
    	}
    }
    return 0;
}

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

int main(){
	string s; cin>>s;
	string a, b;
	int cont=0;
	if (s.size()%2==0){
		
		for(int i=0;i<s.size()/2;++i){
			a.push_back(s[i]);
		}
		for(int i=s.size()/2;i<s.size();++i){
			b.push_back(s[i]);
		}
		
		reverse(b.begin(), b.end());
		for(int i=0; i<a.size();++i){
			if (a[i]!=b[i]) cont++;
		}
	}
	else{
		for(int i=0;i<(s.size()-1)/2;++i){
			a.push_back(s[i]);
		}
		for(int i=(s.size()+2)/2;i<s.size();++i){
			b.push_back(s[i]);
		}
		
		reverse(b.begin(), b.end());
		for(int i=0; i<a.size();++i){
			if (a[i]!=b[i]) cont++;
		}
	}
	cout<<cont;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    string s;
    cin >> s;
    string a = "Sunny", b = "Cloudy", c = "Rainy";
    map<string, string> next = {{a, b}, {b, c}, {c, a}};
    cout << next[s] << '\n';
}

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  string s;
  cin>>s;
  int n=s.size();
  string ans="yes";
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(s[i]==s[j]) ans="no";
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3608
N = int(input())
pos = [list(map(int, input().split())) for i in range(N)]

diffs = {(0,0):0}

for i in range(N):
    for j in range(N):
        if i==j:
            continue
        diff = (pos[j][0] - pos[i][0], pos[j][1] - pos[i][1])
        if diff not in diffs:
            diffs[diff] = 0
        diffs[diff] += 1

print(N-max(diffs.values()))

Measured memory_bytes: 3444
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<int, int> qii;
typedef pair<int, int> pii;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


int main() {
	int a, b, c, k,ans = 0;
	cin >> a >> b >> c >> k;
	int target = max({ a,b,c });
	if (target == a) ans = target * pow(2, k) + b + c;
	if (target == b) ans = target * pow(2, k) + a + c;
	if (target == c) ans = target * pow(2, k) + a + b;

	cout << ans << endl;


	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

const int mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 11

int main()
{
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0,cnt = 0;
    rep(i,s.size()){
        if(s[i] == 'R') cnt++;
    }
    rep(i,cnt){
        if(s[i] == 'W') ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
long double A, B, H, M, ans=0, PI=3.1415926535897932384626;
cin >> A >> B >> H >> M;
long double q=abs(2*PI*((11.0/12)*M/60-H/12)), t=min(q, 2*PI-q);
ans=sqrt(A*A+B*B-2*A*B*cos(t));
cout << setprecision(20) << ans << "\n";
}

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

using namespace std;

int main()
{
    int r,c,n;
    cin>>r>>c>>n;
    int max = (r>c)?r:c;
    int p = n/max;
    if(n%max != 0)cout<<p+1<<endl;
    else cout<<p<<endl;
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char workd[200004];
int l[200004],r[200004];
int main(){
	int n,k,c;
	scanf("%d%d%d",&n,&k,&c);
	scanf("%s",workd+1);
	int cnt=0;
	for(int i=1;i<=n;i++){
		if(workd[i]=='o'){
			l[++cnt]=i;
			i+=c;
		}
		if(cnt>=k)break;
	}
	cnt=k;
	for(int i=n;i>=1;i--){
		if(workd[i]=='o'){
			r[cnt--]=i;
			i-=c;
		}
		if(cnt<1)break;
	}
	for(int i=1;i<=k;i++){
		if(l[i]==r[i])printf("%d\n",l[i]);
	}
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
const int N=1e5+10;
typedef pair<int,int> pii;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,fa[N];
set<int> E[N];
map<pii,int> cnt;
queue<pii> q;
int getf(int x) { return x==fa[x]?x:fa[x]=getf(fa[x]); }
void adde(int u,int v) {
    if(u>v) swap(u,v);
    E[u].insert(v);E[v].insert(u);
    if(++cnt[mp(u,v)]==2) q.push(mp(u,v));
}
int main() {
    cin>>n;
    for(int i=1,u,v;i<=2*n-2;i++) u=gi(),v=gi(),adde(u,v);
    for(int i=1;i<=n;i++) fa[i]=i;
    for(int i=1,x,y;i<n;i++) {
        while(1) {
            if(q.empty()) return puts("NO"),0;
            x=q.front().first;y=q.front().second;q.pop();
            x=getf(x);y=getf(y);
            if(x!=y) break;
        }
        if(E[x].size()>E[y].size()) swap(x,y);
        fa[x]=y;E[y].erase(x);E[x].erase(y);cnt.erase(mp(min(x,y),max(x,y)));
        for(int v:E[x]) {
            v=getf(v);cnt[mp(min(x,v),max(x,v))]--;
            if(v==y) continue;
            adde(v,y);E[v].erase(x);
        }
    }
    puts("YES");
    return 0;
}
//orzgzy
//鸡贼明年进队超稳


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int n;
  cin >> n;
  int x = n*800;
  int y = n/15*200;
  cout << x-y << endl;
}

Measured memory_bytes: 256