akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int n;
int r,c,q;
int r1,c1,r2,c2;
int tmp;
vector<int> seg[1000];

void init(int num,int n_){
  seg[num].clear();
  for(int i=0;i<2*n_-1;i++)seg[num].push_back( (1<<31)-1 );
}

void update(int x,int k, int a){
  k += n-1;
  seg[x][k] = a;
  while(k>0){
    k = (k-1) / 2;
    seg[x][k] = min(seg[x][k*2+1], seg[x][k*2+2]);
  }
}

int query(int x, int a, int b, int k, int l, int r){
  if(r<=a || b<=l)return (1<<31) - 1;
  if(a<=l && r<=b)return seg[x][k];
  else{
    return min(query(x,a,b,2*k+1,l,(l+r)/2),query(x,a,b,2*k+2,(l+r)/2,r));
  }
}

int main(){
  while(1){
    cin >> r >> c >> q;
    if(!r && !c && !q)break;

    if(r>=c){
      n = 1;
      while(n<r)n *= 2;
      for(int i=0;i<c;i++)init(i,n);
      for(int i=0;i<r;i++){
	for(int j=0;j<c;j++){
	  cin >> tmp;
	  update(j,i,tmp);
	}
      }
      while(q--){
	cin >> r1 >> c1 >> r2 >> c2;
	int ans = (1<<31) - 1;
	for(int i=c1;i<=c2;i++)ans = min(ans,query(i,r1,r2+1,0,0,n));
	cout << ans << endl;
      }
    }else{
      n = 1;
      while(n<c)n *= 2;
      for(int i=0;i<r;i++)init(i,n);
      for(int i=0;i<r;i++){
	for(int j=0;j<c;j++){
	  cin >> tmp;
	  update(i,j,tmp);
	}
      }
      while(q--){
	cin >> r1 >> c1 >> r2 >> c2;
	int ans = (1<<31) - 1;
	for(int i=r1;i<=r2;i++)ans = min(ans,query(i,c1,c2+1,0,0,n));
	cout << ans << endl;
      }
    }
  }
}

Measured memory_bytes: 13000
#include <iostream>

using namespace std;

int main(){
    int K, S;
    cin >> K >> S;

    int cnt = 0;
    for(int i = 0; i <= K; i++){
        for(int j = 0; j <= K; j++){
                if((S - i - j) <= K && (S - i - j) >= 0){
                    cnt++;
                }
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,j;
  vector<vector<int>> c(3,vector<int>(3));
  for(i=0;i<3;i++) for(j=0;j<3;j++) cin>>c.at(i).at(j);
  if(c.at(1).at(0)-c.at(0).at(0)!=c.at(1).at(1)-c.at(0).at(1)) cout<<"No"<<endl;
  else if(c.at(1).at(0)-c.at(0).at(0)!=c.at(1).at(2)-c.at(0).at(2)) cout<<"No"<<endl;
  else if(c.at(2).at(0)-c.at(0).at(0)!=c.at(2).at(1)-c.at(0).at(1)) cout<<"No"<<endl;
  else if(c.at(2).at(0)-c.at(0).at(0)!=c.at(2).at(2)-c.at(0).at(2)) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Measured memory_bytes: 3584
#include<stdio.h>
#include<stdlib.h>

void add(int *bit,int index,int v){
  const int n=bit[0];
  for(int i=index;i<=n;i+=i&-i) bit[i]+=v;
}

int sum(int *bit,int index){
  int res=0;
  for(int i=index;i>0;i-=i&-i) res+=bit[i];
  return res;
}

void run(void){
  int n,q;
  scanf("%d%d",&n,&q);
  int *bit=(int *)calloc(n+1,sizeof(int));
  bit[0]=n;
  while(q--){
    int c;
    scanf("%d",&c);
    if(c==0){
      int l,r,v;
      scanf("%d%d%d",&l,&r,&v);
      add(bit,l,v);
      add(bit,r+1,-v);
    } else {
      int x;
      scanf("%d",&x);
      printf("%d\n",sum(bit,x));
    }
  }
}

int main(void){
  run();
  return 0;
}



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

int main() {
	int N;
	cin >> N;
	int a[N] = {}, b[N] = {}, c[N] = {};
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	long long int A[N] = {}, B[N] = {}, C[N] = {}, ans[N] = {};//i日目にaを選んだ時の幸福度
	
	A[0] = a[0];
	B[0] = b[0];
	C[0] = c[0];
	ans[0] = max(max(A[0], B[0]), max(B[0], C[0]));
	for (int i = 1; i < N; i++) {
		A[i] = max(B[i - 1], C[i - 1]) + a[i];
		B[i] = max(A[i - 1], C[i - 1]) + b[i];
		C[i] = max(B[i - 1], A[i - 1]) + c[i];
		ans[i] = max(max(A[i], B[i]), max(B[i], C[i]));
	}

	cout << ans[N-1];
	return 0;
}

Measured memory_bytes: 4480
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.abs
import kotlin.math.cos
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

const val mod = 998244353L
fun Long.mod() = ((this % mod) + mod) % mod

fun solve() {
    val (n, m, k) = readIntegerList()
    val c = Combination(200000, mod)
    var ans = 0L
    for (k in 0..k) ans = (ans + ((m * modPow(m - 1L, n - 1L - k, mod)).mod() * c.value(n - 1, k)).mod()).mod()
    out.println(ans)
}

/** O(log(m)) mod <= 2_147_483_648, n >= 0 */
fun modPow(n: Long, m: Long, MOD: Long = (1L shl 31)): Long {
    if (m < 0) throw ArithmeticException("The power of negative exponent is not integer.")
    if (MOD <= 0) throw ArithmeticException("MOD <= 0")

    var ret = 1L
    var x = (n % MOD)
    if (x < 0) x += MOD
    var k = m
    while (k > 0) {
        if ((k and 1L) == 1L) { ret = (ret * x) % MOD }
        x = (x * x) % MOD
        k = k shr 1
    }
    return ret
}

/** n <= 20000000 */
class Combination(n: Int = 20000000, val MOD: Long = 1000000007L) {
    val fact = LongArray(n + 1)
    val ifact = LongArray(n + 1)

    /** O(n) */
    init {
        fact[0] = 1L
        for (i in 1..n) { fact[i] = (fact[i - 1] * i) % MOD }
        ifact[n] = modInverse(fact[n], MOD)
        for (i in n downTo 1) { ifact[i - 1] = (ifact[i] * i) % MOD }
    }

    /** O(1) */
    fun value(n: Int, k: Int) = if (k < 0 || k > n) 0 else (((fact[n] * ifact[k]) % MOD) * ifact[n-k]) % MOD

    /**
     * O(log(MOD))
     */
    fun modInverse(n: Long, mod: Long = 1000000007L): Long {
        var a = n % mod
        if (a < 0) a += mod

        if (a == 0L) throw ArithmeticException("n is not relatively prime to mod")

        var b = mod
        var u = 1L
        var v = 0L
        while (b > 0) {
            val t = a / b
            a -= t * b
            a = b.also { b = a } // swap(a, b)
            u -= t * v
            u = v.also { v = u } // swap(u, v)
        }
        u %= mod
        if (u < 0) u += mod
        return u
    }
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 40128
#include <string>
#include <iostream>
#include <vector>
using namespace std;
#define S second
main(){
  vector<pair<int,pair<string,int> > >v;
  int i,j,n,m,k;
  string s;
L:
  v.clear();
  if(cin>>n>>m,!n)return 0;
  for(i=0;i<n;v.push_back(make_pair(k,make_pair(s,j))),i++)
    for(cin>>s>>k,j=0;s[j]=='*';j++);
  for(k=0;m;m--)
    for(cin>>s,i=0;i<n;i++)
      if(s.substr(v[i].S.S)==v[i].S.first.substr(v[i].S.S))k+=v[i].first;
  cout<<k<<endl;
goto L;
}

Measured memory_bytes: 936
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
#include<numeric>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9


int main() {
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;

	set<int> water;
	set<int> sugar;

	int i = 1;
	while (100*A*i<=F) {
		int j = 0;
		while (100 * (A * i + B * j) <= F) {
			water.insert(100 * (A * i + B * j));
			j++;
		}
		i++;
	}
	// cout << "size of water " << water.size() << endl;

	i = 0;
	while (C * i <= F) {
		int j = 0;
		while (C * i + D * j <= F) {
			sugar.insert(C * i + D * j);
			j++;
		}
		i++;
	}
	// cout << "size of sugar " << sugar.size() << endl;

	float max = 0;
	pair<int, int> p;
	p.first = A*100; p.second = 0;
	while (water.size() > 0) {
		set<int>::iterator it1 = water.begin();
		float w = *it1;
		set<int> temp(sugar);
		while (temp.size() > 0) {
			set<int>::iterator it2 = temp.begin();
			float s = *it2;
			if (w + s <= F && 100*s <= E*w) {
				if (max < 100*s / (w + s)) { // w=0 かつs=0のときが問題になっていたっぽい
					max = 100*s / (w + s);
					p.first = w + s;
					p.second = s;
				}
			}
			temp.erase(s);
		}
		water.erase(w);
	}
	cout << p.first << " " << p.second << endl;

	return 0;
}

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

dictionary = {}
input_num = int(raw_input())
counter = 0
while counter < input_num:
    command, key = raw_input().split(' ')
    if command == 'insert':
        dictionary[key] = None
    else:
        if key in dictionary:
            print 'yes'
        else:
            print 'no'

    counter += 1

Measured memory_bytes: 33044
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }





int main() {
    ll n;
    cin >> n;
    vector<pair<ll, ll>> v;
    REP(i, n){
        ll a;
        cin >> a;
        v.push_back({a, 1});
    }
    REP(i, n){
        ll b;
        cin >> b;
        v.push_back({b, 2});
    }
    sort(v.begin(), v.end());
    queue<ll> que;
    ll ans = 1;
    REP(i, 2 * n){
        if(que.empty()){
            que.push({v[i].second});
        }
        else{
            if(v[i].second == que.front()){
                que.push({v[i].second});
            }
            else{
                ans *= que.size();
                ans %= MOD;
                que.pop();
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6256
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define all(x) begin((x)), end((x))
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h1,m1,h2,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;
    ll a2 = h2*60+m2;
    ll a1 = h1*60+m1;
    if (a2<= a1) {
        a2 += 60 * 24;
    }
    cout << a2 -a1 -k << endl;
    return 0;
}


Measured memory_bytes: 3652
input=input()
X=int(input)
ans=0
if 400 <=X  and X<=599:
  ans=8
elif 600 <= X and X<=799:
  ans=7
elif 800<=X and X<=999:
  ans=6
elif 1000<=X and X<=1199:
	ans=5
elif 1200<=X and X<=1399:
	ans=4
elif 1400<=X and X<=1599:
	ans=3
elif 1600<=X and X<=1799:
	ans=2
elif 1800<=X and X<=1999:
	ans=1

print(ans)

Measured memory_bytes: 9208
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[][] students = new int[N][2];
		int[][] points = new int[M][2];
		for(int i=0; i<N; i++) {
			students[i][0] = sc.nextInt();
			students[i][1] = sc.nextInt();
		}
		for(int i=0; i<M; i++) {
			points[i][0] = sc.nextInt();
			points[i][1] = sc.nextInt();
		}
		for(int i=0; i<N; i++) {
			int idx = 0;
			for(int j=1; j<M; j++)
				if(distance(students[i], points[j]) < distance(students[i], points[idx]))
					idx = j;
			System.out.println(idx+1);
		}
		sc.close();
	}
	
	static int distance(int[] a, int[] b) {
		int ans = 0;
		for(int i=0; i<a.length; i++)
			ans += Math.abs(b[i]-a[i]);
		return ans;
	}
}


Measured memory_bytes: 21844
n = int(input())
h = list(map(int, input().split()))
for x in range(n-1, 0, -1):
    if h[x-1]-1 == h[x]:
        h[x-1] -= 1
    elif h[x-1] > h[x]:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 14252
#include <iostream>
#include <vector>
//
using namespace std;
int main(void){
    string s,t;
    cin >> s >> t;
    int a,b;
    cin >> a >> b;
    string u;
    cin >> u;
    if(s == u){
        a--;
    }else{
        b--;
    }
    cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repl(i,n) for(int64_t i=0;i<(int64_t)(n);i++)
#define MAX_N 10000000
#define ll int64_t
#define all(v) (v).begin(),(v).end()
using namespace std;

int main() {
    //入力
    ll n; cin>>n;
    vector<ll> a(n+1); vector<ll> b(n);
    repl(i,n+1) cin>>a[i];
    repl(i,n) cin>>b[i];
 
    ll p,count=0;
    repl(i,n) {
      count+=min(a[i],b[i]);
      p=b[i]-min(a[i],b[i]);
      count+=min(p,a[i+1]);
      a[i+1]-=min(a[i+1],p);
      
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split(' ').Select(num => long.Parse(num)).ToArray();
            var a = ab[0];
            var b = ab[1];
            Console.WriteLine(a * b / GCD(a, b));

            long GCD(long x, long y)
            {
                var max = Math.Max(x, y);
                var min = Math.Min(x, y);

                var remain = max % min;
                if (remain == 0)
                {
                    return min;
                }
                else
                {
                    return GCD(min, remain);
                }
            }
        }
    }
}

Measured memory_bytes: 28140
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

mini = min(a) + min(b)
for i in range(M):
    x, y, c = map(int, input().split())
    mini = min(mini, a[x-1] + b[y-1] - c)

print(mini)

Measured memory_bytes: 18612
use proconio::input;

fn main() {
    input! {
        mut a: isize,
        b: isize,
        mut c: isize,
        d: isize,
    }
    loop {
        c -= b;
        if c <= 0 && a > 0 {
            println!("Yes");
            break;
        };
        a -= d;
        if a <= 0 && c > 0 {
            println!("No");
            break;
        }
    }
}


Measured memory_bytes: 2144
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public class Dish
	{
		public int Time {get; set;}
		public int Yammy {get; set;}
	}
	
	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var n = p[0];
		var t = p[1];
		var dishes = new Dish[n];
		for(int i = 0; i < n; i++)
		{
			p = Input().ToInt();
			dishes[i] = new Dish(){Time=p[0], Yammy=p[1]};
		}
		Array.Sort(dishes, (u,v)=>u.Time-v.Time);
		
		//i個目までの料理をj分未満の時間でとれるおいしさの最大
		var dp = new long[n+1, t+3001];
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j < t+3000; j++)
			{
				var d = dishes[i];

				if(j < t && j+d.Time <= t+3000)
				{
					dp[i+1, j + d.Time] = Math.Max(dp[i, j], dp[i, j] + d.Yammy);
				}
				dp[i+1, j] = Math.Max(dp[i, j], dp[i+1,j]);
				
			}
		}
		long max = 0;
		for(int j = t+3000; j >= 0; j--)
		{
			max = Math.Max(max, dp[n, j]);
		}
		Console.WriteLine(max);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}



Measured memory_bytes: 151648
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;

ll MAX = LLONG_MAX;

int main()
{

  int n;
  cin >> n;

  char c[n];
  int ans = 0;

  for (int i = 0; i < n; i++)
    cin >> c[i];

  int right = n - 1, left = 0;

  for (;;)
  {
    for (int i = left; i < n; i++)
    {
      left = i;
      if (c[i] == 'W')
      {
        break;
      }
    }

    for (int i = right; i >= 0; i--)
    {
      right = i;
      if (c[i] == 'R')
      {
        break;
      }
    }

    if (right > left)
    {
      c[left] = 'R';
      c[right] = 'W';
      ans++;
    }
    else
      break;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int a[300000];


int main(){
  
  fill(a+2,a+300000,1);

  FOR(i,2,300000){
    if(!a[i]) continue;
    for(int j=2;i*j<300000;j++){
      a[i*j]=0;
    }
  }

  for(int i=1;i<300000;i++){
    a[i]+=a[i-1];
  }

  while(1){
    int n;
    cin>>n;
    if(n==0) break;
    cout<<a[2*n]-a[n]<<endl;
  }

  return 0;
}


Measured memory_bytes: 4248
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
static const int MAX_N = 100000;

int N;
int A[MAX_N];

void solve(){
	ll ans = 1;
	int cnt = 0;
	sort(A, A + N);
	reverse(A, A + N);
	for(int i = 0; i < N; i++){
		if(A[i] == A[i + 1]){
			ans *= A[i];
			cnt++;
			i++;
		}
		if(cnt == 2) break;
	}
	if(cnt < 2) printf("0\n");
	else printf("%lld\n", ans);
}

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


Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
private static Scanner s = new Scanner(System.in);
static int count = 0;
public static void main(String[] args) {
	int n = s.nextInt();
	int[] a = new int[n];
	StringBuilder sb = new StringBuilder();

	for(int i = 0;i < n;i++) {
		a[i] = s.nextInt();
	}
	margeSort(a,0,n);
for(int i = 0;i < n-1;i++) {
	sb = sb.append(a[i] + " ");
}
System.out.println(sb.toString() + a[n-1]);
System.out.println(count);
}

public static void marge(int[] a,int l,int m,int r) {
	int n1 = m -l;
	int n2 = r - m;
	int[] L = new int[n1+1];
	int[] R = new int[n2+1];

	for(int i = 0;i < n1;i++) {
		L[i] = a[l + i];
	}
	for(int i = 0;i < n2;i++) {
	R[i] = a[m + i];
	}
	L[n1]  = 1000000001;
	R[n2] = 1000000001;

	int i = 0,j = 0;
	for(int k = l;k < r;k++) {
		if(L[i] <= R[j] && L[i] != 1000000001) {
			a[k] = L[i];
			i++;
			count++;
		}else {
			a[k] = R[j];
			j++;
			count++;
		}
	}
}

public static void margeSort(int[] a,int l,int r) {
	int m;
	if(l + 1 < r) {
		m = (l + r)/2;
		margeSort(a,l,m);
		margeSort(a,m,r);
		marge(a,l,m,r);
	}
}
}



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

int main() {
  int N;
  cin >> N;
  set<int> a;
  for (int i = 0;i<N;i++) {
    int b;
    cin >> b;
    a.insert(b);
  }
  cout << a.size() << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

int main(){
  char X,Y;

  cin>>X>>Y;

  if (X < Y) cout<<"<"<<endl;
  else if (X == Y) cout<<"="<<endl;
  else cout<<">"<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
vector<int> fact(ll L){
  ll N = L;
  vector<int> res;
  for(ll i = 2; i * i <= N; i++){
    if(L % i == 0){
      int cnt = 0;
      while(L % i == 0){
        L /= i;
        cnt++;
      }
      res.push_back(cnt);
    }
    if(L == 1) break;
  }
  if(L != 1) res.push_back(1);
  return res;
}

int main(){
  ll L;
  while(cin >> L && L){
    if(L == 1){
      cout << 1 << endl;
      continue;
    }
    vector<int> v = fact(L);
    int dp[2] = {};
    dp[1] = v[0];
    for(int i = 1; i < v.size(); i++){
      dp[(i + 1) & 1] = dp[i & 1] * 2 * v[i] + v[i] + dp[i & 1];
    }
    cout << dp[v.size() & 1] + 1 << endl;
  }
  return 0;
}

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

int main(){
    string s,t ; cin >> s >> t;
    if(t.length()!=s.length()+1){
        cout << "No" << endl;
        return 0;
    } 
    for(int i=0;i<int(s.length());i++){
        if(t[i]!=s[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream> 
#include <unordered_set> 
#include <unordered_map>
#include <algorithm>
#include <string>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main()
{
	long long A,B,N;
	
	cin >>A>>B>>N;
	
	cout << (A*min(N,B-1)/B) << endl;
	return 0;
}

Measured memory_bytes: 3632
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " : " << x << " " << endl
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define int long long
#define gcd __gcd
const int inf = 0x3f3f3f3f;
const int maxn = 201110;
const int M = 1e9+7;

int ksm(int a,int b)
{
	int res = 1;
	while (b)
	{
		if(b&1) res = (res*a)%M;
		a = (a*a)%M;
		b /= 2;
	}
	return res%M;
}

int c(int n,int m)
{	
	m = min(m,n-m);
	int res = 1;
	int ans = 1;
	for(int i = 1; i <= m; i++)
	{
		res = res*i%M;
		ans = ans*(n-i+1)%M;
	}
	return ans*ksm(res,M-2)%M;
}

signed main()
{
	int n,a,b;
	cin>>n>>a>>b;
	int ans = ksm(2,n);
	ans = (ans - c(n,a) - c(n,b) - 1 + 3*M)%M;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
map<long long,int> reps;
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    vector<int> num(n);
    for(int i = 0;i < n;i++)
        scanf("%d",&num[i]),reps[num[i]]++;
    long long BestElement = 0;
    long long firstElement = 0;
    long long secondElement = 0;
    for(map<long long,int>::reverse_iterator it = reps.rbegin();it != reps.rend();it++)
    {
       // cout << it->first << endl;
        if(it->second >= 2)
        {
            if(firstElement == 0)
                firstElement = it->first;
            else
                secondElement = max(secondElement,it->first);
        }
        if(it->second >= 4)
            BestElement = max(BestElement,it->first);
    }
    cout << max(max(secondElement*BestElement,firstElement * secondElement),max(BestElement * BestElement,firstElement * BestElement));
}


Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int a, b;
    cin >> a >> b;
    if ((a * b) % 2 == 0)
    {
        cout << "Even" << endl;
    }
    else
    {
        cout << "Odd" << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <map>
#define debug(x) std::cerr << #x << " = " << (x) << std::endl 

using namespace std;
typedef long long LL;
const int maxn =  1e5;

int n;
int main()
{
	scanf("%d", &n);
	if(n <  1200) printf("ABC\n");
	else if(n >= 1200 && n < 2800) printf("ARC\n");
	else printf("AGC\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
#define INF 1e9+7
#define PI 3.141592653
using namespace std;

int main(){
    float r,g,b,n;
    cin>>r>>g>>b>>n;
    ll ans=0;
    float k=0;
    for(int i=0;i<=n;i++ ){
        for(int j=0;j<=n;j++){
            k=(n-i*r-j*g)/b;
            if(k>=0){
                if(floor(k)==ceil(k)){
                    ans++;
                // cout<<i<<j<<k*b<<endl;
                }
            }
        }
    }
    cout<<ans;
}

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

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

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



Measured memory_bytes: 2044
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>

using namespace std;

int arr[200010];
long long sum[200010];

inline long long cal(long long a, long long b, long long c, long long d)
{
    return max({ a, b, c, d }) - min({ a, b, c, d });
}

int main()
{
    //freopen("in", "r", stdin);
    //freopen("out", "w", stdout);

    int n, i;
    scanf("%d", &n);
    for(i = 1; i <= n; i++)
        scanf("%d", &arr[i]);

    for(i = 1; i <= n; i++)
        sum[i] = sum[i - 1] + arr[i];

    int p, q;
    p = 1;
    q = 3;
    for(i = 3; i <= n - 1; i++)
        if(abs(sum[n] - sum[i] - (sum[i] - sum[2])) <= abs(sum[n] - sum[q] - (sum[q] - sum[2])))
            q = i;

    long long res = cal(arr[1], arr[2], sum[q] - sum[2], sum[n] - sum[q]);
    for(i = 3; i <= n - 2; i++)
    {
        while(p < i - 1)
        {
            if(abs(sum[i] - sum[p + 1] - (sum[p + 1] - sum[0])) <= abs(sum[i] - sum[p] - (sum[p] - sum[0])))
                p++;
            else
                break;
        }

        while(q < n - 1)
        {
            if(abs(sum[n] - sum[q + 1] - (sum[q + 1] - sum[i])) <= abs(sum[n] - sum[q] - (sum[q] - sum[i])))
                q++;
            else
                break;
        }

        res = min(cal(sum[p], sum[i] - sum[p], sum[q] - sum[i], sum[n] - sum[q]), res);
    }

    printf("%lld\n", res);
    return 0;
}

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

using ll = long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define bzero(p, n) memset(p, 0, n)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 

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

    vector<vector<int>> c(3, vector<int>(3));
    cin >> c;

    if (
        c[0][1] - c[0][0] == c[1][1] - c[1][0] && c[1][1] - c[1][0] == c[2][1] - c[2][0]
     && c[0][2] - c[0][1] == c[1][2] - c[1][1] && c[1][2] - c[1][1] == c[2][2] - c[2][1]
     && c[1][0] - c[0][0] == c[1][1] - c[0][1] && c[1][1] - c[0][1] == c[1][2] - c[0][2]
     && c[2][0] - c[1][0] == c[2][1] - c[1][1] && c[2][1] - c[1][1] == c[2][2] - c[1][2]
    ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
s = str(input())
n = len(s)
x = [0]*2019
x[0] = 1
m = 0
j = 1
for i in range(n):
  m = (m + int(s[-i-1])*j)%2019
  x[m] += 1
  j = (j*10)%2019
ans = 0
for i in range(2019):
  ans += (x[i]*(x[i]-1))//2
print(ans)

Measured memory_bytes: 9288
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(i,x,y)  for(int i=int(x);i<int(y);++i)
#define For(i,x,y)  for(int i=int(x);i<=int(y);++i)
#define FOr(i,x,y)  for(int i=int(x);i>=int(y);--i)
#define pi acos(-1) 
#define mk make_pair
#define pa pair<ll,ll>
#define lf else if
#define IL inline
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)      ((x)*(x))
#define Mul(x,y)    ((x)=1LL*(x)*(y)%mod)
#define Add(x,y)    ((x)=((x)+(y))%mod)
#define Max(x,y)    ((x)=((x)<(y)?(y):(x)))
#define Min(x,y)    ((x)=((x)>(y)?(y):(x)))
#define E(x)        return writeln(x),0
#define LL			(long long)
#define p(x)        printf("~%lld~\n",LL(x))
#define pp(x,y)     printf("~~%lld %lld~~\n",LL(x),LL(y))
#define ppp(x,y,z)  printf("~~~%lld %lld %lld~~~\n",LL(x),LL(y),LL(z))
#define pppp(a,b,c,d)	printf("~~~%lld %lld %lld %lld\n",LL(a),LL(b),LL(c),LL(d))
#define f_in(x)     freopen(x".in","r",stdin)
#define f_out(x)    freopen(x".out","w",stdout)
#define open(x)     f_in(x),f_out(x)
#define fi first
#define se second
#define GuYue		puts("\nGuYueNa________________________________________________________________________________")
typedef complex<double> E;
namespace cqz{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_; 
#endif 
#define NEG 1
    static const int GYN=2333333;
    char SZB[GYN],*S=SZB,*T=SZB;
    inline char gc(){   if (S==T){  T=(S=SZB)+fread(SZB,1,GYN,stdin); if (S==T) return '\n';  }   return *S++;    }
#if NEG
    inline ll read(){    ll x=0,g=1; char ch=gc();   for (;!isdigit(ch);ch=gc()) if (ch=='-') g=-1;  for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x*g; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=gc();   for (;!isdigit(ch);ch=gc());    for (;isdigit(ch);ch=gc())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=gc();   for(;isspace(ch);ch=gc());  return ch;  }
    inline ll readstr(char *s){ char ch=gc();   int cur=0;  for(;isspace(ch);ch=gc());      for(;!isspace(ch);ch=gc())  s[cur++]=ch;    s[cur]='\0';    return cur; }
	void Print(long long *a,int s,int t){For(i,s,t)printf("%lld ",a[i]);}
	void Print(int *a,int s,int t){For(i,s,t)printf("%d ",a[i]);}
	void Print(char *a,int s,int t){For(i,s,t)putchar(a[i]);}
	void writeln(ll x){write(x);puts("");}
}using namespace cqz;
ll n,f[200010],a[210005],pos[200105],ans;
int main(){
	n=read();	f[1]=1;
	For(i,1,n) a[i]=read(),pos[a[i]]=i;
	ll x=n-1;
	For(i,2,n){
		if(pos[i]>pos[i-1]) f[i]=f[i-1]+1;
		else f[i]=1;
		x=min(x,n-f[i]);
	}writeln(x);
}

Measured memory_bytes: 6400
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

ll const mod = 998244353;

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  map<ll, ll> pf = prime_factor(n);

  ll ans = 0;
  for (P kv : pf) {
    for (ll i = 1; i <= kv.second; i++) {
      ans++;
      kv.second -= i;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3628
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

a,b,c,d=map(int,input().split())
b_num=b//c + b//d - b//lcm(d,c)
a_num=(a-1)//c + (a-1)//d - (a-1)//lcm(d,c)

print(b-(a-1)-(b_num-a_num))

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
map <char, int> mp;

int main()
{
	string str; cin >> str;
	for (int i = 0; i < (int)str.size(); i++)
	{
		mp[str[i]]++;
	}
	for (auto it : mp)
	{
		if (it.second != 2 || mp.size() != 2)
		{
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5010;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

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

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[101010];

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}

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

char c[2010][2010];

//long longしか使わない
//素数は1より大きい
int main() {
	string s, t;
	cin >> s >> t;
	ll n = s.length();
	vector<ll>start(26, -1);
	vector<ll>goal(26, -1);
	rep(i, n) {
		ll target1 = s[i] - 'a';
		ll target2 = t[i] - 'a';
		if (start[target1] != -1 || goal[target2] != -1) {
			if (start[target1] != target2 || goal[target2] != target1) {
				puts("No");
				return 0;
			}
		}
		else {
			start[target1] = target2;
			goal[target2] = target1;
		}
	}
	puts("Yes");
}

Measured memory_bytes: 776
#include <stdio.h>

int main(void){
    int x, y;
    while(1){
        scanf("%d %d",&x,&y);
        if(x == 0 && y == 0) break;
        if(y < x) printf("%d %d\n", y, x);
        else printf("%d %d\n", x, y);
    }
    return 0;
}

Measured memory_bytes: 600
import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for c in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


if __name__ == '__main__' :
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int x,int y){
    if(y==0)return x;

    return gcd(y,x%y);
}
int lcm(int x,int y){
    return x*y/gcd(x,y);
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){

    int N,A,o=0,e=0;
    cin>>N;

    for(int i=1;i<=N;i++){
        cin>>A;
        if(A%2==0){
            e++;
        }else{
            o++;
        }
    }

    while(o>=2){
        o-=2;
        e++;
    }

    if(o==1){
        cout<<"NO"<<endl;
        return 0;
    }

    while(e>=2){
        e-=2;
        e++;
    }

    if(e==1){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
    ll n;   cin >> n;
    ll res = n*(n-1)/2;
    cout << res << endl;

}

Measured memory_bytes: 3640
#include <iostream>

int main(){
	int A,B,C;
	std::cin>>A>>B>>C;

	for(int i=0;i<1000;++i){
		if(A*i%B == C){
			std::cout<<"YES";
			return 0;
		}	
	}
	std::cout<<"NO";
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] h = new int[n];
      for(int i = 0;i < n;i++){
      	h[i] = sc.nextInt();
      }
      boolean a = true;
      for(int i = n-2;i >= 0;i--){
      	if(h[i] > h[i+1])h[i]--;
      }
      for(int i = 0;i < n-1;i++){
      	if(h[i] <= h[i+1]) a &= true;
        else a = false;
      }
      if(a)System.out.println("Yes");
      else System.out.println("No");
    }
}


Measured memory_bytes: 49272
n = int(input())
dic = {}
price = []
for i in range(n):
  a, x = input().split()
  dic[a] = i
  price.append(int(x))

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

def find(x):
  if parent[x] == x:return x
  parent[x] = find(parent[x])
  return parent[x]

m = int(input())
for _ in range(m):
  s, t = input().split()
  si, ti = dic[s], dic[t]
  ps = find(si)
  pt = find(ti)
  parent[ps] = parent[pt]

groups = {}
for i in range(n):
  if find(i) in groups:
    min_price, cnt = groups[find(i)]
    groups[find(i)] = (min(min_price, price[i]), cnt + 1)
  else:
    groups[find(i)] = (price[i], 1)

print(sum([v[0] * v[1] for _, v in groups.items()]))


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

using namespace std;

int main() {
    int n;
    cin >> n;
    bool wolf[n], resp[n];
    for (int i=0; i<n; i++) {
        char c;
        cin >> c;
        resp[i] = (c == 'o');
    }
    for (int i=0; i<2; i++) {
        for (int j=0; j<2; j++) {
            wolf[n-2] = i;
            wolf[n-1] = j;
            for (int k=0; k<n; k++) {
                bool pw1 = wolf[(n + k - 1) % n],
                     pw2 = wolf[(n + k - 2) % n],
                     pr1 = resp[(n + k - 1) % n];
                wolf[k] = !(pr1 xor pw1 xor pw2);
            }
            if (wolf[n-2] == i && wolf[n-1] == j) {
                for (auto w : wolf) {
                    cout << (w ? 'W' : 'S');
                }
                cout << '\n';
                return 0;
            }
        }
    }
    
    cout << -1 << '\n';
    return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<cstring>
#define p 131
#define mod 19260817
using namespace std;
long long hang[310],lie[310];
long long a[310][310],b[310][310];
char s[310];
long long f[310];
int main()
{
	int n;
	int ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) 
	{
		scanf("%s",s+1);
		for(int j=1;j<=n;j++)
		{
			a[i][j]=s[j]-'a'+1;
		}
	}
	f[0]=1;
	for(int i=1;i<=n;i++) f[i]=f[i-1]*p%mod;
	for(int A=0;A<n;A++)
	{
		memset(hang,0,sizeof(hang));
		memset(lie,0,sizeof(lie));
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++)
			{
				b[(i-A)<1?i-A+n:i-A][j]=a[i][j];
			}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++)
			{
				hang[i]=(hang[i]*p+b[i][j])%mod;
				lie[i]=(lie[i]*p+b[j][i])%mod;
			}
		}
		for(int B=0;B<n;B++)
		{
			if(B)
			for(int i=1;i<=n;i++)
			{
				b[i][B+n]=b[i][B];
				hang[i]=((hang[i]-b[i][B]*f[n-1]%mod+mod)%mod*p+b[i][B])%mod;
				hang[i]=(hang[i]+mod)%mod;
			}
			int flag=1;
			for(int i=1;i<=n;i++) 
			{
				if(hang[i]!=lie[(i+B)>n?i+B-n:i+B]) flag=0;
			}
			if(flag) ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std; 
#define max(a, b) (a < b ? b : a) 
#define min(a, b) ((a > b) ? b : a) 
#define mod 1e9 + 7 
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++) 
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++) 
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--) 
#define INF 1000000000000000003 
typedef long long int ll; 
typedef vector<int> vi; 
typedef pair<int, int> pi; 
#define F first 
#define S second 
#define PB push_back 
#define POB pop_back 
#define MP make_pair
void solve()
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans=0;
	int temp=0;
	if(k<=a)
	{
		cout<<k;
		return;
	}
	else
	{
		ans=a;
		temp=k-a;
	}
	if(temp<=b)
	{
		cout<<ans;
		return;
	}
	else
	{
		temp=temp-b;
	}
	if(temp<=c)
	{
		cout<<ans-temp;
		return;
	}
	
	
 } 
int main() 
{ 
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    solve();
    return 0; 
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long int i,j,n;
  cin>>n;
   long long int a[n+1]={0};
   for(i=1; i<=n; i++)
   {
       for(j=i; j<=n; j=j+i)
       {
           a[j]++;
       }
   }
   long long int sum=0;
   for(i=1; i<=n; i++)
   {
        sum+=(i*(a[i]));
   }
    cout<<sum;
}


Measured memory_bytes: 81712
#include <iostream>
using namespace std;
int main()
{
	int a,b,c,x;
	cin>>a>>b>>c>>x;
	int ways=0;
	for(int i=0;i<=a;i++)
		for(int j=0;j<=b;j++)
			for(int k=0;k<=c;k++)
				if((i*500+j*100+k*50)==x)
					ways++;
	cout<<ways<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    string s,t; cin >> s >> t;
    cout << t << s << endl; return 0;
}


Measured memory_bytes: 256
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
const int INF =100100100;
const int MOD = (int)1e9+7;
const double EPS = 1e-9;
typedef long long ll;
typedef long li;
#define pb push_back 
#define mp make_pair

signed main (){	
	ll NN,ans=0;
	cin >> NN ;
	ll V[NN],C[NN];
	rep(i,NN){
		cin >> V[i];
	}
	rep(i,NN){
		cin >> C[i];
	}
	rep(i,NN) {
		if(V[i] > C[i]) ans += V[i] - C[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)
cnt = 0
for i in range(n//2):
    if s[i]==s[n-1-i] and s[i]==s[i+(n+1)//2]:
        pass
    else:
        cnt += 1
if cnt == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
K = int(input())

memo = dict()
def gcd(x,y):
    if (x,y) in memo:
        return memo[(x,y)]
    if y==0: return x
    memo[(x,y)]=gcd(y,x%y)
    return memo[(x,y)]

ans = 0
gs = dict()
for a in range(1,K+1):
    for b in range(1,K+1):
        g = gcd(a,b)
        gs[g] = gs.get(g,0)+1
for g,n in gs.items():
    for c in range(1,K+1):
        ans += gcd(g,c)*n
print(ans)

Measured memory_bytes: 12740
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-24 16:44:36
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int flag = 0;
  for (auto e : vec) os << (flag++ ? ", " : "{") << e;
  return os << '}';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int flag = 0;
  for (auto e : st) os << (flag++ ? ", " : "{") << e;
  return os << '}';
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int flag = 0;
  for (auto e : mp) os << (flag++ ? ", " : "{") << e;
  return os << '}';
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

int Levenshtein_distance(const std::string& s1, const std::string& s2) {
  int n1 = s1.size(), n2 = s2.size();
  std::vector<std::vector<int>> dp(n1 + 1, std::vector<int>(n2 + 1, 0));
  for (int i = 0; i <= n1; ++i) dp[i][0] = i;
  for (int i = 0; i <= n2; ++i) dp[0][i] = i;
  for (int i = 0; i < n1; ++i) {
    for (int j = 0; j < n2; ++j) {
      const int cost = (s1[i] != s2[j]);
      dp[i + 1][j + 1] = min({dp[i + 1][j] + 1, dp[i][j + 1] + 1, dp[i][j] + cost});
    }
  }
  return dp[n1][n2];
}

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

  string s1, s2; cin >> s1 >> s2;
  cout << Levenshtein_distance(s1, s2) << endl;

  return 0;
}


Measured memory_bytes: 6772