akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static long mod = 1000000007;
	//static long mod =998244353; 
	static System.IO.StringReader sr;
		static void Main(string[] args) {
			char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		long[] vals = parseAryL(Console.ReadLine().Split(cs));
		long res = 0;
		long x = vals[0];
		long y = vals[1];

		long q = x % y;
		res = Math.Min(q, Math.Abs(q - y));


		Console.WriteLine(res);
		return;


	}


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

Measured memory_bytes: 11092
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M = MI()
    A=sorted(LI(), reverse=True)
    num_cost = {
        1:2,
        2:5,
        3:5,
        4:4,
        5:5,
        6:6,
        7:3,
        8:7,
        9:6
    }


    dp = [-inf]*(N+1) #dp[i]:ちょうどi本使ったときの最大桁数
    dp[0] = 0

    for i in range(1,N+1):
        for a in A:
            if i-num_cost[a]>=0:
                dp[i] = max(dp[i], dp[i-num_cost[a]] + 1)

    ans = []
    while N:
        for a in A:
            cost = num_cost[a]
            if N-cost>=0 and dp[N-cost]==dp[N]-1: #aを使って最大桁数で作れる
                ans.append(a)
                N-=cost
                break
    print(*ans,sep="")



if __name__ == '__main__':
    main()

Measured memory_bytes: 42736
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<string>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<iostream>
#include<algorithm>
#include<unordered_map>
#include<unordered_set>
#define PI acos(-1)
#define pb push_back
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
#define dd(x) cout<<#x<<" = "<<x<<","
#define de(x) cout<<#x<<" = "<<x<<"\n"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=1e6+5;
string s[N];
struct node{
	int x,y,id,dis;
};
node a[N];
bool cmp(node a,node b){
	if(a.id!=b.id)
	return a.id>b.id;
	if(a.id>0)
	return a.y>b.y;
	else if(a.id<0){
		if(a.dis!=b.dis)
		return a.dis>b.dis;
		return a.x<b.x;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s[i];
		int cnt=0,mn=0;
		for(int j=0;j<s[i].size();j++){
			if(s[i][j]=='('){
				cnt++;
			}
			else if(s[i][j]==')'){
				cnt--;
			}
			mn=min(mn,cnt);
		}
		if(cnt<0)
		a[i]={cnt,mn,0,cnt-mn};
		else
		a[i]={cnt,mn,1,cnt-mn};
	}
	sort(a+1,a+n+1,cmp);
	int sum=0;
	for(int i=1;i<=n;i++){
		if(sum+a[i].y<0){
			cout<<"No";
			return 0;
		}
		else if(sum+a[i].x<0){
			cout<<"No";
			return 0;
		}
		else{
			sum+=a[i].x;
		}
	}
	if(sum==0)
	cout<<"Yes";
	else
	cout<<"No";
}


Measured memory_bytes: 50492
s = gets.chomp.split("")
# s_re = s.reverse
# i = 0
# while true
#     if s[i] == "A" || s[i] == "G" || s[i] == "C" || s[i] == "T"
#         break
#     elsif s == []
#         break
#     else
#         s.shift
#     end
# end
# p s
# i = 0
# s = s.reverse
# while true
#     if s[i] == "A" || s[i] == "G" || s[i] == "C" || s[i] == "T"
#         break
#     elsif s == []
#         break
#     else
#         s.shift
#     end
# end
# p s
# puts s.size
count = 0
arr = []
(0..s.size).each do |i|
    if s[i] == "A" || s[i] == "G" || s[i] == "C" || s[i] == "T"
        count += 1
    else
        arr << count
        count = 0
    end
end
puts arr.sort.pop

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

int main() {
	string a, b,c;
	cin >> a >> b >> c;
	a[0] -= 32;
	b[0] -= 32;
	c[0] -= 32;
	cout << a[0] << b[0] << c[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<numeric>

using namespace std;

typedef long long ll;

ll gcd(ll a, ll b){
  if( b == 0){ return a;}
  return gcd( b, a % b);}

ll lcm(ll a, ll b){
  ll g = gcd(a,b); ll res = ( a / g ) * b;
  return res;}

int main(){
  int N; cin >> N;  ll ans = 1LL;
  for(int i = 0; i < N; i++){
    ll t; cin >> t;
    ans = lcm(ans, t);}
  
  cout << ans << endl; return 0;}

Measured memory_bytes: 256
N= int(raw_input())
A = list(map(int, raw_input().split()))
start_diff = abs(sum(A[1:]) - A[0])
diff = sum(A[1:]) - A[0]
for index in xrange(1,len(A)-1):
        diff -= A[index] * 2
	if abs(diff) < start_diff:
		start_diff = abs(diff)

print start_diff

Measured memory_bytes: 18440
package main 

import(
    "bufio"
    "fmt"
    "os"
)

var r = bufio.NewReader(os.Stdin)

func main(){
    var a,b int
    fmt.Fscan(r, &a)
    fmt.Fscan(r, &b)
    
    ans:=a*b
    ans2:=a*2+b*2
    fmt.Println(ans ,ans2)
}


Measured memory_bytes: 1144
import sys
# sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
# arr = [[int(el) for el in input().split()] for i in range(n)]

import itertools

def cal(n, m, q, arr):

    def cal_set(s):

        score = 0
        s_arr = list(s)
        l = len(s_arr)

        for a, b, c, d, in arr:
            if 0 <= a - 1 < l and 0 <= b - 1 < l:
                if s_arr[b - 1] - s_arr[a - 1] == c:
                    score += d

        return score

    max_score = 0

    comb_list = itertools.combinations_with_replacement(list(range(m)), n)

    for s in comb_list:
        max_score = max(max_score, cal_set(s))

    return max_score


n, m, q = map(int, input().split())

arr = []
for _ in range(q):
    a, b, c, d = map(int, input().split())
    arr.append((a, b, c, d))

print (cal(n, m, q, arr))

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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int a, b, c;
  cin >> a >> b >> c;
  if (a == 1 && b == 1 && c == 1) {
    cout << 0 << '\n';
    return 0;
  }
  if (a == b && b == c) {
    cout << -1 << '\n';
    return 0;
  }
  int cnt = 0;
  while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
    ++cnt;
    int A = a / 2, B = b / 2, C = c / 2;
    a = B + C;
    b = A + C;
    c = A + B;
  }

  cout << cnt << '\n';
  return 0;
}

Measured memory_bytes: 3648
#include <cassert>

template <class Monoid, template <class> class Container> class segment_tree {
public:
	using value_structure = Monoid;
	using value_type = typename value_structure::value_type;
	using container_type = Container<value_type>;
	using const_reference = typename container_type::const_reference;
	using size_type = typename container_type::size_type;

private:
	size_type size_, capacity;
	container_type c;
	static size_type getsize(const size_type size) {
		size_type ret = 1;
		while (ret < size)
			ret <<= 1;
		return ret;
	}
	void recalc(const size_type index) {
		c[index] = value_structure::operation(c[index << 1], c[index << 1 | 1]);
	}

public:
	segment_tree() : size_(0), capacity(0), c() {}
	explicit segment_tree(const size_type size)
		: size_(size), capacity(getsize(size_)),
		c(capacity << 1, value_structure::identity()) {}

	bool empty() const { return !size_; }
	size_type size() const { return size_; }

	const_reference operator[](const size_type index) const {
		assert(index < size());
		return c[index + capacity];
	}
	value_type fold(size_type first, size_type last) const {
		assert(first <= last);
		assert(first <= size());
		assert(last <= size());
		value_type ret_l = value_structure::identity(),
			ret_r = value_structure::identity();
		for (first += capacity, last += capacity; first < last;
			first >>= 1, last >>= 1) {
			if (first & 1)
				ret_l = value_structure::operation(ret_l, c[first++]);
			if (last & 1)
				ret_r = value_structure::operation(c[last - 1], ret_r);
		}
		return value_structure::operation(ret_l, ret_r);
	}
	template <class F> size_type search(const F &f) const {
		if (f(value_structure::identity()))
			return 0;
		if (!f(c[1]))
			return size() + 1;
		value_type acc = value_structure::identity();
		size_type i = 1;
		while (i < capacity)
			if (!f(value_structure::operation(acc, c[i <<= 1])))
				acc = value_structure::operation(acc, c[i++]);
		return i - capacity + 1;
	}

	void update(size_type index, const value_type &value) {
		assert(index < size());
		index += capacity;
		c[index] = value;
		while (index >>= 1)
			recalc(index);
	}
};

#include <algorithm>
#include <limits>
template <class T> class min_monoid {
public:
	using value_type = T;
	static value_type operation(const value_type &x, const value_type &y) {
		return ::std::min(x, y);
	}
	static value_type identity() {
		return ::std::numeric_limits<value_type>::max();
	}
	static value_type reverse(const value_type &x) { return x; }
};

#include <iostream>
#include <vector>

template<class T> using vec_alias = ::std::vector<T>;

int main() {
	int n, q;
	::std::cin >> n >> q;
	segment_tree<min_monoid<int>, vec_alias> seg(n);

	while (q--) {
		int c, x, y;
		::std::cin >> c >> x >> y;
		if (c)
			::std::cout << seg.fold(x, y + 1) << ::std::endl;
		else
			seg.update(x, y);
	}

	return 0;
}



Measured memory_bytes: 3788
#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) (x).begin(), (x).end()
const int inf = 1e9;
const long long INF=1e15;
#define endl '\n'
#define rep(i, n) for(int i=0;i<(n);++i)
#define repp(i, a, b) for(int i=(a);i<=(b);++i)
#define pb push_back
#define eb emplace_back
#define fastio ios::sync_with_stdio(false);cin.tie(0); //cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

void solve() {
	ll k, n; cin >> k >> n;
	vll a(n); rep(i, n) cin >> a[i];
	ll mini = INF;
	rep(i, n-1) mini = min(mini, k - (a[i+1]-a[i]) );
	mini = min(mini, k - (a[0]-(a[n-1]-k)) );
	cout << mini;
}
int main() {
	fastio;
	solve();
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ull N;
    cin >> N;
    ull counter{0}, k{1};
    while (true){
        if (N < k*10){
            break;
        } else {
            k *= 10;
            counter += 1;
        }
    }
    ull maximum = (N / k)*k;
    ull remmax = k - 1;

    if (N-maximum == remmax){
        cout << N/k+counter*9 << endl;
    } else {
        cout << N/k+counter*9 - 1 << endl;
    }

    return 0;
}

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

int main(void)
{
    long long N;
    cin >> N;
    char c[220000];
    for(int i=0; i < N; ++i) cin >> c[i];

    long long migi_R = -1;
    long long hidari_W = -1;

    for(int i=0; i < N; ++i){
        if(c[i] == 'R') migi_R = i;
    }
    for(int i=0; i < N; ++i){
        if(c[i] == 'W') {
            hidari_W = i;
            break;
        }
    }

    if(hidari_W == -1 || migi_R == -1){
        cout << 0 << endl;
    }else{
    long long i;
    long long count = 0;
    while(hidari_W < migi_R){
        count++;

        for(int j = hidari_W+1; j < N; ++j){
            if(c[j] == 'W'){
                hidari_W = j;
                break;
            } 
            hidari_W = j;
        }

        for(int j = migi_R-1; j > 0; --j){
            if(c[j] == 'R'){
                migi_R = j;
                break; 
            } 
             migi_R = j;
        }

        c[migi_R] = 'W';
        c[hidari_W] = 'R';
    }

    cout << count << endl;
    }
}


Measured memory_bytes: 3760
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;
typedef long long int ll;

// ll dp[1000000002];

// void solve() {
// 	for(ll i = 0; i < n - 1; i++)
// 	{
// 		for(ll k = 0; k < n; k++)
// 		{
			
// 		}
// 	}
// }

int main(int argc, char const *argv[])
{
	ll n;
	cin >> n;

	cout << (n - 2) * 180 << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <ll,ll>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;


int dp[3005][3005];
int main()
{
	vector <vector<PII>> p(3005, vector<PII>(3005)); 
	string s, t, ans;
	cin >> s >> t;
	int n = (int) s.size();
	int m = (int) t.size();
	memset(dp, 0, sizeof(dp));
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= m; ++j)
		{
			if(s[i - 1] == t[j - 1])
			{
				if(dp[i][j] < dp[i - 1][j - 1] + 1)
				{
					dp[i][j] = dp[i - 1][j - 1] + 1;
					p[i][j] = {i - 1, j - 1};	
				}
			}
			if(dp[i][j] < dp[i - 1][j])
			{
				dp[i][j] = dp[i - 1][j];
				p[i][j] = {i - 1, j};	
			}
			if(dp[i][j] < dp[i][j - 1])
			{
				dp[i][j] = dp[i][j - 1];
				p[i][j] = {i, j - 1};	
			}
		}
	}
	int cx = n, cy = m, px, py;
	while(cx != 0 && cy != 0)
	{
		px = p[cx][cy].ff;
		py = p[cx][cy].ss;
		if(dp[cx][cy] > dp[px][py])
			ans.push_back(s[cx - 1]);
		cx = px;
		cy = py;
	}
	reverse(all(ans));
	cout << ans;
}


Measured memory_bytes: 176768
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
int dp[55][105][105],n,a[105],ret;
int main(){
	cin>>n;
	for(int i=1;i<=2*n-1;i++) cin>>a[i];
	sort(a+1,a+2*n);
	dp[n][1][1] = 1;
	for(int i=n;i>=1;i--){
		for(int j=1;j<=2*n-1;j++){
			for(int k=1;k<=j;k++){
				if(i==1) ret=(ret+dp[i][j][k])%mod;
				if(dp[i][j][k] == 0) continue;
				int L = (a[i] != a[i-1]);
				int R = (a[2*n-i] != a[2*n-i+1]);
				if(L){
					dp[i-1][j+L+R-(k-1)][1] += dp[i][j][k];
					dp[i-1][j+L+R-(k-1)][1] %= mod;
				}
				if(R){
					dp[i-1][j+L+R-(j-k)][j+L+R-(j-k)] += dp[i][j][k];
					dp[i-1][j+L+R-(j-k)][j+L+R-(j-k)] %= mod;
				}
				for(int x=1;x<=j;x++){
					dp[i-1][j+L+R-max(0,abs(x-k)-1)][(x>k?L+k+1:L+x)] += dp[i][j][k];
					dp[i-1][j+L+R-max(0,abs(x-k)-1)][(x>k?L+k+1:L+x)] %= mod;
				}
			}
		}
	}
	cout<<ret<<endl;
}

Measured memory_bytes: 1408
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

n = int(input())
l = list(map(int, input().split()))

l.sort()
if (l[-1] < sum(l[0:-1])):
    print("Yes")
else:
    print("No")







Measured memory_bytes: 9136
#include<iostream>
#include<vector>

int main (){
    std::cin.tie(0); 
	std::ios::sync_with_stdio(false);
    int N;std::cin >> N;
    std::vector<int> L(N);
    for (int i=0;i<N;++i){
        std::cin >> L[i];
    }
    int ans=0;
    int Li,Lj,Lk;
    for (int i=0;i<N;++i){
        Li=L[i];
        for (int j=i+1;j<N;++j) {
            Lj=L[j];
            if (Li==Lj){continue;}
            for (int k=j+1;k<N;++k) {
                Lk=L[k];
                if (Li != Lk && Lj != Lk && (Li + Lj) > Lk && (Lj + Lk) > Li && Lk + Li > Lj ) {
                    ++ans;
                }
            }
        }
    }

    std::cout << ans;
    return 0 ;
}


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

int main(){
    int n;
    cin>>n;
    set<int> s;
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        s.insert(k);
    }
    cout<<(s.size()==n?"YES":"NO");
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<ll>
#define pb push_back
#define ff first
#define ss second
#define inf 2e18
#define ull unsigned long long
#define pi acos(-1.0)
#define mod 1000000007
#define lop0(n) for(ll i=0;i<n;i++)
#define lopj(n) for(ll j=0;j<n;j++)
#define lop1(n) for(ll i=1;i<=n;i++)
#define all(v) v.begin(),v.end()
ll Set(ll N,ll pos){ return N=N | (1LL<<pos); }
ll reset(ll N,ll pos){ return N= N & ~(1LL<<pos); }
bool check(ll N,ll pos){ return (bool)(N & (1LL<<pos)); }
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

main()
{
    ll n,k;
    cin>>n>>k;
    vi v;
    while(n--)
    {
        ll a;
        cin>>a;
        v.pb(a);
    }
    sort(all(v));
    ll ans=0;
    lop0(k)
    {
        ans+=v[i];
    }
    cout<<ans;
}



Measured memory_bytes: 3616
#include <stdio.h>
 
int main() {
  int i, n, x;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    x = i;
    if (x % 3 == 0) {
      printf(" %d", i);
      continue;
    }
    for (;;) {
      if (x % 10 == 3) {
        printf(" %d", i);
        break;
      }
      x /= 10;
      if (!x) break;
    }
  }
  printf("\n");
  return 0;
}






Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

//const long long INF = 1LL << 60;
const int INF = 1001001001;

struct DisjointSet{
  vector<int> rank, p;

  DisjointSet(){}
  DisjointSet(int size){
    rank.resize(size, 0);
    p.resize(size, 0);
    rep(i, size) makeset(i);
  }

  void makeset(int x){
    p[x] = x;
    rank[x] = 0;
  }

  int find(int x){
    if(p[x] == x) return x;
    return p[x] = find(p[x]);
  }

  bool same(int x, int y){
    return find(x) == find(y);
  }

  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;

    if(rank[x] < rank[y]) p[x] = y;
    else if(rank[x] > rank[y]) p[y] = x;
    else { p[x] = y; rank[y]++; }
  }
};

struct Edge{
  int from, to, cost;
  Edge(){}
  Edge(int from, int to, int cost):
  from(from), to(to), cost(cost) {}
  bool operator < (const Edge &e) const {
    return cost < e.cost;
  }
};

int kruskal(int n, vector<Edge> edges){
  sort(all(edges));
  DisjointSet dset = DisjointSet(n);

  int sum = 0;
  for(Edge e : edges){
    if(dset.same(e.from, e.to)) continue;
    sum += e.cost;
    dset.unite(e.from, e.to);
  }

  return sum;
}

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

  vector<Edge> edges(m);
  rep(i, m){
    int f, t, c;
    cin >> f >> t >> c;
    edges[i] = Edge(f, t, c);
  }

  cout << kruskal(n, edges) << endl;
 
  return 0;
}





Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
 
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
 
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
 
#define _  %  MOD
#define __ %= MOD
 
#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))
 
#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
#define fbo find_by_order
#define ook order_of_key
 
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent
ll n,x,y;
const int maxn =2e3+3;
ll cnt[maxn];
int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    cin>>n>>x>>y;
	repA(i,1,n)
	{
		repA(j,i+1,n)
		{
			ll dist=0ll;
			if(i<x && j>y)
			{
				dist=1+(x-i)+(j-y);
			}
			else if(i<x && j<=x)
			{
				dist=j-i;
			}
			else if(i>=y)
			{
				dist =j-i;
			}
			else if(i>=x && j<=y)
			{
				dist=min(abs(i-x) +abs(j-y) +1ll,abs(i-j));
			}
			else if(i<x && j<=y) 
			{
				dist=abs(i-x)+min(1ll+abs(j-y),abs(j-x));
			}
			else if(i<=y && i>=x && j>y)
			{
				dist=abs(j-y) + min(1ll+abs(x-i),abs(y-i));
			}
			cnt[dist]++;
			
		}
	}
	repA(i,1,n-1) cout<<cnt[i]<<'\n';
	return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!



Measured memory_bytes: 3632
fn main() {
    let (a, b) = read_tuple::<i64>();

    let mut res = None;
    for i in 1..2000 {
        if i * 8 / 100 == a && i * 10 / 100 == b {
            res = Some(i);
            break;
        }
    }

    match res {
        Some(i) => println!("{:?}", i),
        None => println!("-1"),
    }
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
fn read_tuple<T: std::str::FromStr + Copy>() -> (T, T) {
    let temp = read_vec();
    (temp[0], temp[1])
}



Measured memory_bytes: 4352
#include<cstdio>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

typedef long long LL;

LL n,a,b;

int main()
{
	scanf("%lld %lld %lld",&n,&a,&b);
	
	if (n==1)
	{
		printf("%d\n",(a==b) ?1 :0 );
	} else
	{
		if (a>b) {printf("0\n"); return 0;}
		
		LL nmin=a*(n-1)+b, nmax=a+(n-1)*b;
		
		printf("%lld\n",nmax-nmin+1);
	}
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] $){
		//入力
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		sc.close();

		//処理
		int ans = 0;
		int x = 0;
		for(int i = 0; i < n; i++){
			if(s.charAt(i) == 'I') x++;
			else x--;
			ans = Math.max(ans, x);
		}

		//出力
		System.out.println(ans);
	}
}


Measured memory_bytes: 21972
using System;
using System.Collections.Generic;
using System.Text;

namespace ALDS1_3C{
    public class Program{
        public static void Main(string[] args){
            var N = int.Parse(Console.ReadLine());

            var ll = new LinkedList<string>();
            for(var i = 0; i < N; i++){
                var c = Console.ReadLine().Split();
                if(c[0] == "insert") ll.AddFirst(c[1]);
                if(c[0] == "delete") ll.Remove(c[1]);
                if(c[0] == "deleteFirst") ll.RemoveFirst();
                if(c[0] == "deleteLast") ll.RemoveLast();
            }

            var sb = new StringBuilder();
            foreach(var s in ll) sb.Append(s).Append(" ");
            Console.WriteLine(sb.ToString().Trim());
        }
    }
}

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

int n, m, a, b, c, t;
mat mul(mat&a, mat&b) {
	mat c(a.size(), vec(b[0].size()));
	rep(i, a.size())rep(j, b[0].size())rep(k, b.size())
		(c[i][j] += a[i][k] * b[k][j]) %= m;
	return c;
}
mat ppow(mat a, int b) {
	mat res(a.size(), vec(a.size()));
	rep(i, a.size())res[i][i] = 1;
	while (b) {
		if (b & 1)res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}
int main() {
	while (scanf("%d%d%d%d%d%d", &n, &m, &a, &b, &c, &t), n) {
		mat A(n, vec(n)), B(n, vec(1));
		rep(i, n)scanf("%d", &B[i][0]);
		rep(i, n)rep(j, n) {
			if (j == i - 1)A[i][j] = a;
			if (j == i)A[i][j] = b;
			if (j == i + 1)A[i][j] = c;
		}
		A = ppow(A, t);
		A = mul(A, B);
		rep(i, n) {
			if (i)printf(" ");
			printf("%d", A[i][0]);
		}
		puts("");
	}
}

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

const int MAXN = 500;
int c[MAXN];

void add(int x) {
    while (x <= MAXN) {
        c[x] += 1;
        x += x & -x;
    }
}

int get(int x) {
    int res = 0;
    while (x > 0) {
        res += c[x];
        x -= x & -x;
    }
    return res;
}


int main() {
    int N, M, Q;
    cin >> N >> M >> Q;
    vector< pair<int, int> > trains;
    for (int i = 0; i < M; i++) {
        int L, R;
        cin >> L >> R;
        trains.push_back(make_pair(R, L));
    }
    vector< pair< pair<int, int>, int > > queries;
    for (int i = 0; i < Q; i++) {
        int p, q;
        cin >> p >> q;
        queries.push_back(make_pair(make_pair(q, p), i));
    }
    sort(trains.begin(), trains.end());
    sort(queries.begin(), queries.end());
    vector<int> ans(Q, 0);
    int idx = 0;
    for (int i = 0; i < Q; i++) {
        pair< pair<int, int>, int > pi = queries[i];
        pair<int, int> p = pi.first;
        int qidx = pi.second;
        while (idx < M && trains[idx].first <= p.first) {
            add(trains[idx].second);
            idx++;
        }
        ans[qidx] = idx - get(p.second - 1);
    }
    for (int i = 0; i < Q; i++) {
        cout << ans[i] << "\n";
    }

    return 0;
}

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

//num1とnum2の値を入れ替える
void SwapNum(int *num1, int *num2)
{
    int tmp;
    tmp = *num1;
    *num1 = *num2;
    *num2 = tmp;
}

int main(void)
{
    int box_A, box_B, box_C;
    cin >> box_A >> box_B >> box_C;

    SwapNum(&box_A, &box_B);
    SwapNum(&box_A, &box_C);
    cout << box_A << " " << box_B << " " << box_C << endl;
    return 0;
}


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

int main(){
    string str;
	cin >> str;
 
	stack<int> s;
	for (int i = 0; i < str.length(); i++)
	{
		if (str[i] == '0')
			s.push(0);
		else if (str[i] == '1' )
			s.push(1);
		else
		{
			if (s.empty() == false)
				s.pop();
		}
	}
 
	stack<int> temp;
	while (s.empty() == false)
	{
		temp.push(s.top());
		s.pop();
	}
 
	while (temp.empty() == false)
	{
		cout << temp.top() ;
		temp.pop();
	}
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<pair<ll, ll>> pll;
 
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
	
  string s;
  cin >> s;
  map<char, ll> mp;
  for(ll i = 0; i < s.size(); i++) mp[s[i]]++;
  ll a = mp['a'], b = mp['b'], c = mp['c'];
  if(max({a, b, c})-min({a, b, c}) <= 1) cout << "YES" << endl;
  else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,u,v;
    cin>>n>>u>>v;
    u--,v--;
    vector<vector<int>> g(n);
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    auto bfs=[&](int st,vector<int> &dist){
        queue<int> que;
        dist[st]=0;
        que.push(st);
        while(!que.empty()){
            int v=que.front();
            que.pop();
            for(auto to:g[v]){
                if(chmin(dist[to],dist[v]+1)){
                    que.push(to);
                }
            }
        }
    };
    vector<int> dist1(n,INF),dist2(n,INF);
    bfs(u,dist1);
    bfs(v,dist2);
    int ans=-INF;
    rep(i,n){
        if(dist1[i]<dist2[i] && g[i].size()==1){
            chmax(ans,dist2[i]);
        }
    }
    cout<<ans-1<<endl;
}

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

m = {}
for a in A:
	if not a in m:
		m[a] = 1
	else:
		m[a] += 1

keys = sorted(m, key=lambda x:m[x])

msum = 0
for i in range(len(m) - K):
	msum += m[keys[i]]

print(msum)


Measured memory_bytes: 32184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

int n;
double x[11];
string u[11];
signed main() {
    cin >> n;
    double ans = 0;
    for (int i=0;i<n;i++) cin >> x[i] >> u[i];
    for (int i=0;i<n;i++) {
        if (u[i] == "JPY") ans += x[i];
        else ans += x[i]*380000;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod. m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll a, ll n){
    ll res = 1;
    while(n>0){
        if(n&1){
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>=1;
    }
    return res;
}

int d;
ll ans=0;
int c[26]; // 満足度の下がりやすさ、（d-最終日）* cだけその日の終わりに引かれる。

int s[365][26]; // d日目にタイプiのコンテストを開いた時の上昇量
int t[365];

ll solve(){
    ll tmp_ans=0;
    int day=1;
    vint last[26];
    int last_num[26] = {0};
    rep(i,26) last[i].pb(0);
    rep(i,d){
        tmp_ans += s[i][t[i]];
        last[t[i]].pb(day);
        last_num[t[i]]++;
        rep(j,26){
            tmp_ans -= c[j] * (day - last[j][last_num[j]]);
        }
        day++;
    }
    return tmp_ans;
}

int main(){
    time_t start = time(NULL);
    cin >> d;
    rep(i, 26) cin >> c[i];
    rep(i,d){
        int max_s =0;
        rep(j,26){
            cin >> s[i][j];
            if(max_s < s[i][j]){
                max_s = s[i][j];
                t[i] = j;
            }
        }
    }
    // cout << start << endl;
    int count=0;
    while(count < 20000){
        count++;
        int md = rand()%26;
        int mq = rand()%26;
        int old = t[md];
        t[md] = mq;
        ll tmp_ans = solve();
        if(ans < tmp_ans){
            ans = tmp_ans;
        }else{
            t[md] = old;
        }
        // time_t end = time(NULL);
        // if(end - start > 1900) break;
    }
    // cout << "count = " << count << endl;
    rep(i,d){
        cout << t[i]+1 << endl;
    }
}


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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans=0;
	if(k>=a){
		ans+=(a*1);
		k=k-a;
	}
	else{
		ans+=k*1;
		k=0;
	}
	if(k>=b){
		k=k-b;
	}
	else{
		k=0;
	}
	if(k>=c){
		ans+=c*-1;
		k=k-c;
	}
	else{
		ans+=k*-1;
		k=0;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>

int main(){
        int n;
        scanf("%d", &n);
        for(int i=1; i<10; i++){
                for(int j=1; j<10; j++){
                        if(i*j==n){
                                puts("Yes");
                                return 0;
                        }
                }
        }
        puts("No");
        return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n, m = [int(s) for s in input().strip().split()]
    A = [int(s) for s in input().strip().split()]
    s = sum(A)
    A.sort()
    if A[-m] * 4 * m >= s:
        print("Yes")
    else:
        print("No")


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
using System;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = int.Parse(_[0]);
            var b = int.Parse(_[1]);
            var c = int.Parse(_[2]);

            bool flag = false;
            for(var i = 1; i <= 100; i++){
                var n = a * i;
                if(n % b == c){
                    flag = true;
                    break;
                }
            }

            Console.WriteLine(flag ? "YES" : "NO");
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

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

    long long r_n = 0;
    long long b_n = 0;
    long long g_n = 0;
    for(int i=0; i<N; ++i){
        if(S[i] == 'R') r_n++;
        else if(S[i] == 'G') g_n++; 
        else if(S[i] == 'B') b_n++; 
    }

    long long cum = r_n*g_n*b_n;
    for(int i=0; i<N; ++i){
        for(int j=0; j+i<N; ++j){
            if(i-j >= 0){
                if(S[i-j]!=S[i] && S[i]!=S[i+j] && S[i-j]!=S[i+j]){
                    cum--;

                }
            }    
        }
    }

    // for(int i=0; i<N; ++i){
    //     for(int j=i+1; j<N; ++j){
    //         if(S[i]!=S[j]){
    //             for(int k=j+1; k<N; ++k){
    //                 if(S[i]!=S[k] && S[j]!=S[k]){
    //                     if(j-i != k-j){
    //                         cum++;
    //                     }
    //                 }
    //             }
    //         }
    //     }
    // }

    cout << cum << endl;
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

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

  int m1, d1, m2, d2;
  cin >> m1 >> d1 >> m2 >> d2;
  cout << (m1 == m2 ? 0 : 1) << endl;
}


Measured memory_bytes: 256
import os
import sys
from collections import defaultdict as ddic, Counter, deque
from itertools import combinations, permutations, product
import bisect, heapq

FAST_INPUT = 0
if FAST_INPUT:
    from atexit import register
    from io import BytesIO
 
    sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
    sys.stdout = BytesIO()
    register(lambda: os.write(1, sys.stdout.getvalue()))
 
rr = lambda: sys.stdin.readline().rstrip('\r\n')
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
MOD = 10**9 + 7

DEBUG = 0
if DEBUG:
    import random
    random.seed(0)
    ri = random.randint

#####

def solve(N, A):
    ans = [1] * N
    for i in range(N - 1):
        if S[i] == '<':
            ans[i+1] = ans[i] + 1
    
    for i in range(N - 2, -1, -1):
        if S[i] == '>':
            ans[i] = max(ans[i], ans[i+1] + 1)
    #print ans
    return sum(ans) - N
    
#####
S = rr()
N = len(S)
print solve(N+1, S)




















Measured memory_bytes: 37356
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const A = BigInt(arg[0].split(" ")[0]);
    const B = BigInt(arg[0].split(" ")[1].split(".").join(""));

    // const J  = BigInt(B.split(".")[0]);
    // const S1 = BigInt(B.split(".")[1].split("")[0]);
    // const S2 = BigInt(B.split(".")[1].split("")[1]);
    
    // let answer = (A * J) + ((A * S1) / 10n) + ((A * S2) / 100n);
    
    let answer = A * BigInt(B);
    let length = String(answer).length;
    
    let temp = answer.toString().split("").slice(0, length - 2).join("");
    
    if(temp.length) {
        console.log(temp);
    } else {
        console.log(0);
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29624
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>

using namespace std;

int main()
{
	string s;
	cin >> s;
	if (s.length() == 6 && s[2] == s[3] && s[4] == s[5])
		cout << "Yes\n";
	else cout << "No\n";
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
 
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
#define INF 1000000007
 
#define ARRAY_MAX 100005
 
int main(){

    int n;
    while(cin >> n,n){
        vector<int> vec;
        int mini = INF;
        for(int i = 0;i*i*i <= n;i++){
            for(int j = 0;j*j <= n;j++){
                if(n - i*i*i - j*j >= 0){
                    mini = min(mini,i+j+n-i*i*i-j*j);
                }
            }
        }
        cout << mini << endl;
    }



    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST

ll all_divs(ll n){
    vector<ll> ret;
    for(ll i = 1 ; i*i <= n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i*i != n){
                ret.push_back(n/i);
            }
        }
    }
    return ret.size();
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    ll N;
    cin >> N;
    ll total = 0;
    for(size_t i=1;i<=N; i++)
    {
        for(size_t j=i;j<=N; j+=i)
        {
            total += j;
        }
    }
    cout << total << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3656
H ,N = [int(i) for i in input().split()]
AB = []
for _ in range(N):
    AB.append([int(i) for i in input().split(' ')])

M = max(A for A, B in AB)

DP = [0] * (H+M)

for i in range(1,H+1):
    DP[i] = min(DP[i-a]+b for a,b in AB)

print(DP[H])

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

using namespace std;

using ll = long long;

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

    int n;cin>>n;
    int ybegin = 100000;
    vector<vector<int>> g(200000);
    for (int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        g[x].push_back(ybegin + y);
        g[ybegin + y].push_back(x);
    }
    ll ret = -n;
    vector<int> usd(200000, 0);
    for (int i = 0; i < 200000; i++)
    {
        if (usd[i])
            continue;
        ll x = 0, y = 0;
        queue<int> que;
        que.push(i);
        usd[i] = 1;
        if (i < ybegin)
            x++;
        else
            y++;
        while (!que.empty())
        {
            int cur = que.front();
            que.pop();
            for (auto v : g[cur])
            {
                if (usd[v])
                    continue;
                que.push(v);
                usd[v] = 1;
                if (v < ybegin)
                    x++;
                else
                    y++;
            }
        }
        ret += x * y;
    }
    cout << ret << endl;
}


Measured memory_bytes: 8960
#include <cctype>
#include <stdio.h>
 
using namespace std;
 
int main() {
  char word;
 
  while (true) {
    scanf("%c", &word);
    if (islower(word)) printf("%c", toupper(word));
    else printf("%c", tolower(word));
 
    if (word == '\n') break;
  }
  return 0;
}

Measured memory_bytes: 940