akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using intpv=vector<intpair>;
using llpair=pair<ll,ll>;
using llpv=vector<llpair>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;
using pairmat=vector<llpv>;
#define matrix(T) vector<vector<T>>
#define PI 3.141592653589793
#define INTINF 1<<30
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353
#define pqueue priority_queue
#define pushb push_back
#define fi first
#define se second
#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())
#define init(v,size) v.resize(size); for(auto &a__: v) cin>>a__
#define matin(mat,H,W) for(int i__=0; i__<H; i__++)for(int j__=0; j__<W; j__++) cin>>mat[i__][j__]
#define out(n) cout<<n<<endl

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

template<class T> inline void outmat(T& a, int y, int x) {
	for(int i=0; i<y; i++) {
		for(int j=0; j<x; j++) cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

ll GCD(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll binpow(ll a, ll ex, ll p) { //繰り返し二乗法
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}

ll Fact(ll x, ll p) { //階乗
	ll f=1;
	for(ll i=2; i<=x; i++) {
		f*=i;
		f%=p;
	}
	return f;
}

ll nPr(ll n, ll r) {
	if(n<r) return 0;

	ll result=1LL;
	for(ll i=0; i<r; i++) result*=n-i;
	return result;
}

ll nPrP(ll n, ll r, ll p) { // mod pにおけるnPr
	if(n<r) return 0;

	ll result=1LL;
	for(int i=0; i<r; i++) {
		result*=n-i;
		result%=p;
	}
	return result;
}

ll nCr(ll n, ll r) {
	if (n == r) { return 1; }
	if (r > n) { return 0; }

	if (r > n / 2) { r = n - r; }

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll div=1LL;
	while(n/div) {
		digit++;
		div*=10;
	}
	return digit;
}

bool Palind(string s) { //回文判定
	return s == string(s.rbegin(), s.rend());
}


string A,B;

void input() {
	cin>>A>>B;
}

void solve() {
	for(int i=0; i<A.length(); i++) {
		if(A[i]!=B[i]) {
			cout<<"No"<<endl;
			return;
		}
	}
	cout<<"Yes"<<endl;
}

int main() {
	while(1) {
		input();
		solve();
		break;
	}
}


Measured memory_bytes: 3636
import fractions
A, B, C, D = map(int, input().split())


def func(x,y):
    if(x<0):
        assert()
    if(y<=0):
        assert()
    # print(x,y,int(x/y))
    # return int((x/y))
    # print(x,y,x//y)
    return int((x//y))

# print(func(100,10))


lcm = int((C * D) / int(fractions.gcd(C, D)))
print(int( B - func(B, C) - func(B, D) + func(B, lcm) - A + 1 + func(A-1, C) + func(A-1, D) - func(A-1, lcm)))


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

const int N = 2010, mod = 1e9 + 7;
typedef long long LL;

inline int Pow(int x, int y) {
	if (y < 0) return 1;
	int res = 1;
	for (; y; y >>= 1, x = (LL)x * x % mod) if (y & 1) res = (LL)res * x % mod;
	return res;
}

int dp[N][N], g[N][N];

inline void Inc(int &x, int y) {
	x += y, x -= x >= mod ? mod : 0;
}

int main() {
	int n, k; scanf("%d%d", &n, &k), dp[0][n + 1] = g[0][n + 1] = 1;
	for (int i = 1; i <= k; i++) {
		for (int j = 1; j <= n; j++) {
			dp[i][j] = g[i - 1][n + 1] - g[i - 1][j] + mod, Inc(dp[i][j], 0);
			if (i - 1 < n - j + 1) Inc(dp[i][j], dp[i - 1][j]); 
		}
		for (int j = 1; j <= n + 1; j++) 
			g[i][j] = g[i][j - 1] + dp[i][j], Inc(g[i][j], 0);
	}
	printf("%d\n", (LL)(dp[k][1] - dp[k - 1][1] + mod) * Pow(2, n - k - 1) % mod);
}

Measured memory_bytes: 31744
#include<bits/stdc++.h>
using namespace std;
#define mod             1000000007
#define w(x)            int x; cin>>x; while(x--)
#define mk(arr,n,type)  type *arr=new type[n];
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
int main() {
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	char c;
	cin >> c;
	if (c > 64 && c < 91)
		cout << "A" << endl;
	else
		cout << "a" << endl;
	return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin>>str;
    map<int,int>mp;
    long long int ans=0;
    int val=0;
    mp[0]=1;
    int c=1;
    for(int i=str.size()-1;i>=0;--i)
    {
        val+=(str[i]-'0')*c;
        val%=2019;
        c=c*10;
        c%=2019;
        ++mp[val];
    }
    map<int,int>::iterator it;
    for(it=mp.begin();it!=mp.end();++it)
    {
        ans+=(it->second-1)*(it->second)/2;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3716
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        List<Integer> lengthOfSticks = new ArrayList<>();
        for (int i = 0; i < 2 * n; ++i) {
            lengthOfSticks.add(scanner.nextInt());
        }
        lengthOfSticks.sort(Comparator.naturalOrder());
        long result = 0;
        for (int i = 0; i < n; ++i)
            result += lengthOfSticks.get(2 * i);
        System.out.println(result);
    }
}


Measured memory_bytes: 21716
#include<iostream>
using namespace std;
typedef long long ll;
ll qpow(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1)res*=x;
        y/=2;
        x=x*x;
    }
    return res;
}
int main()
{
    ll x,y,n,ans=1;
    cin>>x>>y;
    if(x==1){cout<<y<<endl;return 0;}
    if(y==1){cout<<1<<endl;return 0;}
    for(int i=2;(n=qpow(i,x))<=y&&n>qpow(i-1,x)&&n;i++)
    {
        //cout<<i<<' '<<n<<endl;
        if(!(y%n))ans=i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int t,k,j,i,c,a,b;

    cin>>a>>b;
    if(a==b)
        cout<<a+b<<endl;
    else if(a<b)
        cout<<b+(b-1)<<endl;
    else
        cout<<a+a-1<<endl;
}


Measured memory_bytes: 256
conf = 0
num_char = int(input())
char = list(map(int, input().split()))
char.sort(reverse=True)
count = 0
conf_int = 0
for i in range(num_char):
  if count == 0:
    count = 1
  elif count == 1:
    count = 2
    conf = char[conf_int]
    count_int = 0
    conf_int = 1
  else:
    if count_int == 0 :
      conf += char[conf_int]
      count_int = 1
    else:
      conf += char[conf_int]
      conf_int += 1
      count_int = 0
print(conf)

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

int dp[101][100001];
int W[101];
int val[101];
int knapsack(int i,int w,int n){
   
   // if(w==0)return 0;
    if(i==n)return 0;
    if(dp[i][w]!=-1)return dp[i][w];
    if(w>=W[i])dp[i][w]=max(knapsack(i+1,w,n),val[i]+knapsack(i+1,w-W[i],n));
    
    else dp[i][w]=knapsack(i+1,w,n);
    return dp[i][w];
}
int32_t main()
{
    int n,w;
    cin>>n>>w;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++)cin>>W[i]>>val[i];
    int ans=knapsack(0,w,n);
    cout<<ans<<endl;



  return 0;
}

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

def main():

    S = input()

    listS = list(S)
    listS.sort()

    ans = 'No'
    
    if listS[0] == listS[1] and listS[2] == listS [3] and listS[1] != listS[2]:
        ans = 'Yes'

    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 9008
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n;
    cin >> n;
    ll t, x, y, ct = 0, cx = 0, cy = 0;

    REP(i, n){
        cin >> t >> x >> y;
        ll dist = abs(x - cx) + abs(y - cy), dt = t - ct;
        if(!(dist % 2 == dt % 2 && dist <= dt)){
            cout << "No" << endl;
            return 0;
        }
        ct = t;
        cx = x;
        cy = y;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



int main() {
	string b;
	cin >> b;

	string a;
	for (int i = 0; i < b.length(); i++) {
		char c;
		switch (b[i])
		{
		case 'A':
			c = 'T';
			break;
		case 'T':
			c = 'A';
			break;
		case 'C':
			c = 'G';
			break;

		default:
			c = 'C';
			break;
		}
		a += c;
	}
	cout << a << endl;
}


Measured memory_bytes: 3608
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }


enum A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];

void main() {
  try {
    for (; ; ) {
      const K = readInt() - 1;
      writeln(A[K]);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 256
fun main(omkar: Array<String>) {
    var s = readLine()!!
    val t = readLine()!!
    val dpLength = Array(s.length + 1) { IntArray(t.length + 1) }
    val dpChar = Array(s.length + 1) { CharArray(t.length + 1) }
    for (x in 1..s.length) {
        for (y in 1..t.length) {
            dpLength[x][y] = dpLength[x - 1][y]
            dpChar[x][y] = 'S'
            if (dpLength[x][y - 1] > dpLength[x][y]) {
                dpLength[x][y] = dpLength[x][y - 1]
                dpChar[x][y] = 'T'
            }
            if (s[x - 1] == t[y - 1] && dpLength[x - 1][y - 1] + 1 > dpLength[x][y]) {
                dpLength[x][y] = dpLength[x - 1][y - 1] + 1
                dpChar[x][y] = 'B'
            }
        }
    }
    var x = s.length
    var y = t.length
    val answer = mutableListOf<Char>()
    while (x > 0 && y > 0) {
        when (dpChar[x][y]) {
            'S' -> x--
            'T' -> y--
            'B' -> {
                answer.add(s[x - 1])
                x--
                y--
            }
        }
    }
    println(answer.reversed().joinToString(""))
}

Measured memory_bytes: 110076
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;

const int maxn = 2e5 + 5;
map<LL,int> ans;
LL a[maxn];

int main(){
	int n; scanf("%d",&n);
	LL sum = 0,cnt = 0;
	for(int i = 1;i <= n;i++) scanf("%lld",&a[i]);
	for(int i = 1;i <= n;i++){
		sum += a[i];
		//printf("%lld %d\n",sum,ans[sum]);
		if(sum == 0) cnt++;
		cnt += ans[sum];
		ans[sum]++;
	}
	printf("%lld\n",cnt);
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  ll h;
  cin >> h;
  ll ans = 0;
  for (int i = 0; 0 < h; i++) {
    h /= 2;
    ans += pow(2, i);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
PY = [list(map(int, input().split())) + [i] for i in range(M)]
PY = sorted(PY, key=lambda x: x[1])
ans = []
cnt = [0]*N
for p, y, i in PY:
    ans.append(["%06d%06d" % (p, cnt[p - 1] + 1), i])
    cnt[p - 1] += 1
ans = sorted(ans, key=lambda x: x[1])
for a, i in ans:
    print(a)

    


Measured memory_bytes: 43340
# coding: utf-8

def getMinMax(A):
    nmin = 10**9+1
    nmax = 0
    for ai in A:
        if nmin > ai:
            nmin = ai
        if nmax < ai:
            nmax = ai
    return nmin, nmax

def getAbs(minmax):
    return abs(minmax[0] - minmax[1])

if __name__ == "__main__":
    N = int(input())
    A = [int(x) for x in input().split()]
    print(getAbs(getMinMax(A)))

    


Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a + b >= a - b && a + b >= a * b){
        printf("%d",a + b);
    } else if (a - b > a * b){
        printf("%d",a - b);
    } else {
        printf("%d",a * b);
    }
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll roundd(ll x,ll n){
  if(x>n){return x%n;}
  else if(x<0){return x%n+n;}
  else return x;
}

int main(){
  ll n,m;cin>>n>>m;
  priority_queue<ll> q;
  vvll ok(100001);
  rep(i,0,n){
    ll a,b;cin>>a>>b;
    ok[a].push_back(b);
  }
  ll ans=0;
  rep(i,1,m+1){
    for(auto u:ok[i])q.push(u);
    if(!q.empty()){
      ll t=q.top();
      ans+=t;
      q.pop();
    }
  }
  cout<<ans<<endl;
}



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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int ans=0,len;
    len=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A' || s[i]=='T' || s[i]== 'C'|| s[i]=='G')
          len++;
        else
            len=0;
          if(len>ans)
                ans=len;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) cout << "Bad";
    else cout << "Good";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

priority_queue<int, vector<int>, greater<int>> solve (int n){
    long long sum = 0;
    long long max_int = 0;
    long long num;
    priority_queue<int, vector<int>, greater<int>> ret;
    for (long long i = 1; i <= n; ++i){
        sum += i;
        if(sum >= n){
            max_int = i;
            break;
        }
    }
    long long rest = n;
    num = max_int;
    while(rest > 0){
        if(rest - num >= 0){
            ret.push(num);
            rest -= num;
        }
        num--;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    priority_queue<int, vector<int>, greater<int>> answer = solve(n);
    while(!answer.empty()){
        int ans = answer.top();
        answer.pop();
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 384
s = input().rstrip()


def flip(c):
    return '1' if c == '0' else '0'


a, b = 0, 1
pre_a, pre_b = s[0], flip(s[0])

for i in range(1, len(s)):
    if pre_a == s[i]:
        a += 1
        pre_a = flip(s[i])
    else:
        pre_a = s[i]

    if pre_b == s[i]:
        b += 1
        pre_b = flip(s[i])
    else:
        pre_b = s[i]

print(min(a, b))

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

int main(){

  ll N; cin >> N;
  vector<ll> A(N); ll sum = 0; 
  for(ll i = 0; i < N; i++) {cin >> A[i]; sum += A[i];}
  
  ll rem = N*(N+1); rem /= 2;
  
  if( sum % rem != 0 ){ cout << "NO" << endl; return 0;}
  
  ll k = sum/rem;
  
  bool flag = true; ll test = 0;
  
  for(int i = 0; i < N; i++){
    ll d = A[i];
    if(i){ d -= A[i-1];}
    else{ d -= A[N-1];}
    
    
    ll check = k-d;
    
    if( check >= 0 && check % N == 0 ){ 
      test += check/N;
    }
    else{
      flag = false;
    }
  }
  
  
  if( flag && test  == k ){
    cout << "YES" << endl;
  }
  else{
    cout <<"NO" << endl;
  }
  
  return 0;
}
  

Measured memory_bytes: 1024
n = int(input())
h = [ list(map(int,input().split())) for _ in range(n)]

ans = []
for i in range(101):
  for j in range(101):
    h.sort(key=lambda x: -x[2])
    hmax = h[0][2] + abs(i-h[0][0]) + abs(j-h[0][1])
    for k in range(1,n):

      if max(hmax - abs(h[k][0] - i) - abs(h[k][1] - j) , 0) != h[k][2]:
        break

    else:
      ans = [i,j,hmax]
    
    if(len(ans)):
      break
  if(len(ans)):
    break

ans = map(str,ans)
print(' '.join(ans))

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

using namespace std;

template<class T> inline bool chmin(T &a, T b){
  if(a > b){
    a = b;
    return true;
  }
  return false;
}

const long long INF = 1LL << 62;

int main(void){
  long long N,K;
  long long ans=INF;
  long long sumK=0;
  cin >> N >> K;


  sumK = (N/K + 1) * K;
  chmin(ans, sumK - N);
  chmin(ans, N - sumK + K);
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main() {
    long long X, K , D;
    cin >> X >> K >> D;
    // int sign;
    // if(X >= 0) sign =1;
    // else sign = -1;
    X = abs(X);
    long long r = X % D;
    long long q = X/ D;
    if( K <= q) {
        cout << X - (K * D);
    } else {
        K -= q;
        long long Y = r;
         Y = D - r; 
        if( K % 2 == 0) {
            cout << r;
        } else {
            cout << D - r;
        }
    }
    return 0;
}

Measured memory_bytes: 3620
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
sumdigits(n) = sum(digits(n))

function main()
    n,a,b=parseMap(split(readline()))
    ans=0
    for i in 1:n
        if a<=sumdigits(i)<=b
            ans+=i
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 112856
#include <iostream>

using namespace std;

int main(){
  long long s, c, cc, ans;
  cin >> s >> c;
  cc = c/2;
  if(s>cc){
    ans += cc;
  }else{
    ans += s;
    c -= s*2;
    ans += c/4;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define sum(v) accumulate(all(v), 0)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define MOD 1000000007
#define PI acos(-1)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>

using namespace std;

// clang-format on

main {
  int n, m;
  cin >> n >> m;
  int t[n] = {};
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    t[a - 1]++;
    t[b - 1]++;
  }
  rep(i, n) cout << t[i] << endl;
  bye;
}


Measured memory_bytes: 256
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <assert.h>
#include <math.h>
#include <memory.h>
#include <stdio.h>

#include <algorithm>
#include <complex>
#include <ctime>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define left asdgashgrketwjklrej
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-12
#define M_PI 3.141592653589793
#define bsize 1024

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 500031;

int x;
int gcd(int a,int b){
	while (a&&b)a>b?a%=b:b%=a;
	return a+b;
}

int lcm(int a,int b){
	return a/gcd(a,b)*b;
}

int main() {
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", sttextdout);
  ios_base::sync_with_stdio(0);
  // cin.tie(0);

  cin>>x;
  long long T=lcm(x,360);
  cout<<T/x<<endl;

  cin.get(); cin.get();
  return 0;
}


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


int main() {
  int n;
  cin >> n;
  int ans = 2 * n;
  if(n%2 == 0) ans = n;
  cout << ans << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pii pair<int,int>
using namespace std;
typedef long long ll;
#define rint register int
const int maxn=100007;
const int inf=(1LL<<29);
char s[maxn];
int main(){
    cin.tie(0);ios_base::sync_with_stdio(false);
    int n,m;cin>>n>>m;
    cin>>s+1;
    s[m]-='A'-'a';
    cout<<s+1;
    return 0;
}


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

int main(int argc, const char * argv[]) {
    string st; cin >> st;
    for (int i = 0; i < st.length(); i++) {
        if (st[i] == '1') {
            cout << 9;
        } else {
            cout << 1;
        }
    }
    cout << endl;
    
    return 0;
}



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

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int edge[51] = {};
    int n , m;
    cin >> n >> m;
    REP(i, m){
        int a, b;
        cin >> a >> b;
        edge[a]++;
        edge[b]++;
    }
    FOR(i, 1, n){
        cout << edge[i] << "\n";
    }

    return 0;
}


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

using namespace std;

#define N 100000

char str[N + 2];
char p[N + 2];
int idx[N + 2];
int sum[N + 2];
int n;

bool palindrome(char *s, int l, int r){
	int i, j;

	for (i = l, j = r; i < j; i++, j--){
		if (s[i] != s[j]){
			return false;
		}
	}

	return true;
}

int query(int l, int r){
	return max(0, sum[r] - sum[l - 1]);
}

int main(){
	int ans, n, m, i, j, l, r;

	scanf("%[^\r\n]%n", str + 1, &n);

	for (i = 1; i <= n; i++){
		sum[i] = sum[i - 1] + (str[i] == 'x');
	}

	for (i = 1, j = 1; i <= n; i++){
		if (str[i] != 'x'){
			p[j] = str[i];
			idx[j] = i;
			j++;
		}
	}

	m = j - 1;

	if (!palindrome(p, 1, m)){
		printf("-1\n");
	}
	else{
		ans = 0;

		for (i = 1, l = 1, j = m, r = n; i <= j; i++, j--){
			ans += abs(query(l, idx[i] - 1) - query(idx[j] + 1, r));

			l = idx[i] + 1;
			r = idx[j] - 1;
		}

		printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 1280
n,m,x=map(int,input().split())
a=[int(x) for x in input().split()]

mas=[0 for i in range(n+1)]

for aa in a:
    mas[aa-1]=1

l1=mas[0:x]
l2=mas[x:n]

print(min(sum(l1),sum(l2)))


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

int main(){

    while(1){
        int n, r;
        cin >> n >> r;
        if(n == 0){
            break;
        }

        vector<int> now(n);
        vector<int> next(n);

        for(int i = 0; i < n; i++){
            now[i] = n - i;
        }

        int p, c;
        for(int i = 0; i < r; i++){
            cin >> p >> c;
            for(int j = 0; j < c; j++){
                next[j] = now[p - 1 + j];
            }
            for(int j = 0; j < p - 1; j++){
                next[c + j] = now[j];
            }

            for(int j = c + p - 1; j < n; j++){
                next[j] = now[j];
            }

            swap(now, next);
        }

        cout << now[0] << endl;
    }

    return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}



struct RollingHash {
  typedef tuple<ll,ll,ll> HashType;

  const ll mod1 = 999999893;
  const ll mod2 = 999999929;
  const ll mod3 = 999999937;
  const ll b1 = 3422539;
  const ll b2 = 1245103;
  const ll b3 = 22961;
  vector<ll> h1, h2, h3;
  vector<ll> pow1, pow2, pow3;

  RollingHash(const string &s) {
    const int n = s.size();
    h1.assign(n+1, 0);
    h2.assign(n+1, 0);
    h3.assign(n+1, 0);
    pow1.assign(n+1, 1);
    pow2.assign(n+1, 1);
    pow3.assign(n+1, 1);
    REP(i, n) {
      h1[i+1] = (h1[i] * b1 + s[i]) % mod1;
      h2[i+1] = (h2[i] * b2 + s[i]) % mod2;
      h3[i+1] = (h3[i] * b3 + s[i]) % mod3;
      pow1[i+1] = pow1[i] * b1 % mod1;
      pow2[i+1] = pow2[i] * b2 % mod2;
      pow3[i+1] = pow3[i] * b3 % mod3;
    }
  }

  HashType get(int l, int r) {
    ll v1 = ((h1[r] - h1[l] * pow1[r-l]) % mod1 + mod1) % mod1;
    ll v2 = ((h2[r] - h2[l] * pow2[r-l]) % mod2 + mod2) % mod2;
    ll v3 = ((h3[r] - h3[l] * pow3[r-l]) % mod3 + mod3) % mod3;
    return HashType {v1, v2, v3};
  }
};

int nextInt() { int x; scanf("%d", &x); return x;}

const int SZ = 512345 * 4;
bool mark[SZ];
int done[SZ];

int main2() {
  string s, t;
  cin >> s >> t;

  int No = s.size();
  while (s.size() < No + t.size() + 10) s = s + s;

  int Ns = s.size();
  int Nt = t.size();

  s = s + s;

  RollingHash sh(s);
  RollingHash th(t);

  CLR(mark, 0);
  CLR(done, -1);

  for (int i = 0; i < Ns; i++) {
    if (sh.get(i, i + Nt) == th.get(0, Nt)) {
      mark[i] = true;
    }
  }

  int ans = 0;

  for (int i = 0; i < Ns; i++) {
    if (mark[i] && done[i] == -1) {
      int len = 0;
      int pos = i;
      while (mark[pos]) {
        if (done[pos] != -1) {
          len += done[pos];
          break;
        }
        len++;
        pos = (pos + Nt) % Ns;
        if (pos == i) {
          cout << -1 << endl;
          return 0;
        }
      }
      ans = max(ans, len);
      pos = ((pos - Nt) % Ns + Ns) % Ns;
      int x = 0;
      while (pos != i) {
        ++x;
        done[pos] = x;
        pos = ((pos - Nt) % Ns + Ns) % Ns;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 225828
///Bismillahir Rahmanir Rahim
#define ll long long
#define ull unsigned long long
#define scf1(a)  scanf("%lld",&a)
#define scf2(a,b)  scanf("%lld %lld",&a,&b)
#define pf    printf
#define pb    push_back
#define rsrt(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define ff first
#define ss second
#define spd ios_base::sync_with_stdio(false)
#include<bits/stdc++.h>
using namespace std;
ll N=1e5;
int main()
{
    spd;
    ll n,m,a,i,tot=0,pen=0;

    map<ll,ll>ac,mp;
    string s;
    cin>>n>>m;

   for(i=0;i<m;i++)
   {
       cin>>a>>s;
       if(!ac[a]&&s=="AC")
       {
           ac[a]=1;
           tot++;

           pen+=mp[a];
       }

       else if(!ac[a]&&s=="WA")
       {
           mp[a]++;
       }
   }

    cout<<tot<<" "<<pen<<endl;
}


Measured memory_bytes: 12800
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace AtCoder.ABC067
{
    class Program
    {
        static void Main()
        {
            string[] inputs = Console.ReadLine().Split(' ');
            int n = int.Parse(inputs[0]);
            int k = int.Parse(inputs[1]);
            int lengthOfSnake = Console.ReadLine().Split(' ')
                        .Select(int.Parse)
                        .OrderByDescending(elem => elem)
                        .Where((val, idx) => idx < k)
                        .Sum();
            Console.WriteLine(lengthOfSnake);
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using plpii = std::pair<long long, std::pair<int, int>>;

using namespace std;

const long long _MOD = 1000000007;
const long long MOD = 998244353;

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

	ll x;
	cin >> x;
	ll t = 100;
	int ans = 0;
	while (t < x) {
		t += t / 100;
		++ans;
	}

	cout << ans << "\n";

	return 0;
}



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

struct StCrd
{
  string m_sMrk;
  int    m_nNum;
  int    m_nSeq;
};

void fnInput(int &rnMaxSiz, vector<StCrd> &rvoCrd)
{
  cin >> rnMaxSiz;

  rvoCrd.resize(rnMaxSiz);
  for (int i = 0; i < rnMaxSiz; i++)
  {
    cin >> rvoCrd[i].m_sMrk >> rvoCrd[i].m_nNum;
    rvoCrd[i].m_nSeq = i + 1;
  }
}

int fnPartition(vector<StCrd> &rvoCrd, int nFront, int nBack)
{
  int nMid = nFront;

  for (int i = nFront; i < nBack; i++)
    if (rvoCrd[i].m_nNum <= rvoCrd[nBack].m_nNum)
      swap(rvoCrd[nMid++], rvoCrd[i]);

  swap(rvoCrd[nMid], rvoCrd[nBack]);
  return nMid;
}

void fnQuickSort(vector<StCrd> &rvoCrd, int nFront, int nBack)
{
  if (nFront < nBack)
  {
    int nMid = fnPartition(rvoCrd, nFront, nBack);
    fnQuickSort(rvoCrd, nFront, nMid - 1);
    fnQuickSort(rvoCrd, nMid + 1, nBack);
  }
}

void fnResult(const vector<StCrd> &cnrvoCrd)
{
  bool bStable = true;
  for (int i = 0; i < cnrvoCrd.size();    )
  {
    int j = i;
    while (cnrvoCrd[i].m_nNum == cnrvoCrd[++j].m_nNum)
      if (cnrvoCrd[i].m_nSeq < cnrvoCrd[j].m_nSeq);
      else
      {
        bStable = false; 
        goto LOOP_END;
      }

    i = j;
  }

LOOP_END:
  if (bStable)  cout << "Stable" << endl;
  else          cout << "Not stable" << endl;

  for (int i = 0; i < cnrvoCrd.size(); i++)
    cout << cnrvoCrd[i].m_sMrk << " " << cnrvoCrd[i].m_nNum << endl;
}

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

  int nMaxSiz;
  vector<StCrd> voCrd;

  fnInput(nMaxSiz, voCrd);
  fnQuickSort(voCrd, 0, voCrd.size() - 1);
  fnResult(voCrd);

  return 0;
}

Measured memory_bytes: 7332
<?php
while (true){
    list($m, $f, $r) = explode(" ", trim(fgets(STDIN)));
    $total_score = $m + $f;
    if ($m == -1 && $f == -1 && $r == -1) {
        break;
    }
    if ($total_score < 30 || $m == -1 || $f == -1) {
        echo 'F'. PHP_EOL;
    } elseif ($total_score >= 80) {
        echo 'A'. PHP_EOL;
    } elseif ($total_score >= 65 && $total_score < 80) {
        echo 'B'. PHP_EOL;
    } elseif ($total_score >= 50 && $total_score < 65 || $r >= 50) {
        echo 'C'. PHP_EOL;
    } elseif ($total_score >= 30 && $total_score < 50) {
        echo 'D'. PHP_EOL;
    }
}

Measured memory_bytes: 9228
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include <cmath>
//#include <bits/stdc++.h>
using namespace std;

int main(){
    string S;
    cin>>S;
    size_t N=S.length();
    int h=(N+1)/2,x=1;
    for (int i=0;i<h-1;i++){
        if (S[i]!=S[N-1-i]||S[i]!=S[h-2-i]) x=0;
    }
    if (x==1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

//using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
template<typename T> void chadd(T& a, T b) { a = a + b; }

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	// 最小公倍数
	ll lcm(ll a, ll b) {
		return a / gcd(a, b) * b;
	}
}

int main() {

	int a, b, x;
	std::cin >> a >> b >> x;

	double ans;

	// a^3tanθ == a^2b - x となるとき

	double v = static_cast<double>(a * a * b);
	double dx = static_cast<double>(x);

	// 45ドを境に計算式変わる 後で修正
	if (v < dx * 2.0) {
		ans = std::atan(2.0 * (v - dx) / static_cast<double>(a * a * a));
	}
	else ans = std::atan(static_cast<double>(a * b * b) / (2.0 * dx));

	std::cout << std::fixed << std::setprecision(10) << ans * 180.0 / std::acos(-1) << std::endl;

	return 0;
}

Measured memory_bytes: 256
//package cf;
import java.io.*;
import java.util.*;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    static int p=1000000007;
    static int dp[]=new int[100000];
    public static void main(String[] args) throws Exception{
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        FastReader sc=new FastReader();
        int tc=sc.nextInt();
        int ar[]=new int[tc];
        for(int i=0;i<tc;i++)
            ar[i]=sc.nextInt();
        int dp1[]=new int[tc];
        dp1[0]=0;
        //dp1[1]=Math.abs(ar[1]-ar[0]);
        for(int i=1;i<tc;i++)
        {
            dp1[i]=Math.min((Math.abs(ar[i]-ar[i-1]))+dp1[i-1],i-2<0?Integer.MAX_VALUE:(Math.abs(ar[i]-ar[i-2])+dp1[i-2]));
        }
      //  System.out.println(Arrays.toString(dp1));

        //Arrays.fill(dp,-1);

        //System.out.println(frog(ar,0)+" "+Arrays.toString(dp));

        out.write(dp1[tc-1]+"");
        out.flush();
    }
    public static  int frog(int ar[],int i)
    {
        if(i==ar.length-1)
            return 0;
        if(i>=ar.length)
            return Integer.MAX_VALUE;
        if(dp[i]!=-1)
            return dp[i];

        int r1=Math.abs(ar[i]-ar[i+1])+frog(ar,i+1);
        int r2=i+2>=ar.length?Integer.MAX_VALUE:(Math.abs(ar[i]-ar[i+2])+frog(ar,i+2));

            dp[i]=Math.min(r1,r2);
            //System.out.println(i+" "+dp[i]+" "+frog(ar,i+1));
            return dp[i];
    }






///////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }


}


Measured memory_bytes: 31712
#include<bits//stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = (1LL << 60);
ll n, m = 6, k, q, ans, sum =0,b,c; 
int main() {
    vector<ll> a(100010,INF);
    cin >> n;
    a[0] = 0;
    for (ll i = 0; i < n; i++) {
        a[i + 1] = min(a[i + 1], a[i] + 1);
        m = 6;
        while (m + i <= n) {
            a[m + i] = min(a[m +i] , a[i] + 1); m *= 6;
        }m = 9;
        while (m + i <= n) {
            a[m + i] = min(a[m + i], a[i] + 1); m *= 9;
        }
    }
    cout << a[n] << endl;
}

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

int main(){
  string s,t,u;
  int a,b;
  cin>>s>>t>>a>>b>>u;
  if(s==u) cout<<a-1<<" "<<b;
  else if(t==u) cout<<a<<" "<<b-1;
  else cout<<a<<" "<<b;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static kyoupuro.Input;
using static kyoupuro.MyMath;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var a = NextInt();
            var b = NextInt();

            Console.WriteLine((a / Gcd(a, b)) * b);

        }
    }

    class MyMath {
        public static long mod = 1000000007;

        public static long Gcd(long a, long b) {
            return b == 0 ? a : Gcd(b, a % b);
        }

        public static List<long> Factor(long n) {
            var list = new List<long>();
            n = DivideToLimit(n, 2, list);
            n = DivideToLimit(n, 3, list);
            long sqrt = Sqrt(n);
            for (int i = 5; i <= n && i <= sqrt; i += 4) {
                n = DivideToLimit(n, i, list);
                i += 2;
                n = DivideToLimit(n, i, list);
            }
            if(n > 1) list.Add(n);
            return list;
        }

        public static long Sqrt(long n) {
            if (n < 0) return 0;
            long a = 0, tmp = 0, b = 0;
            for (int i = 62; i >= 0; i -= 2) {
                tmp = (b << 1) + 1 <= (n >> i) ? 1 : 0;
                a = a << 1 | tmp;
                n -= (((b << 1) + 1) * tmp) << i;
                b = (b << 1) + tmp + tmp;
            }
            return a;
        }

        static long DivideToLimit(long divisor, long dividend, List<long> list) {
            while(divisor % dividend == 0) {
                list.Add(dividend);
                divisor /= dividend;
            }
            return divisor;
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 13268
#include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
#include<cmath>
using namespace std; 


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

Measured memory_bytes: 256
from math import ceil
n=int(input())
flag=True
xceil=ceil(n/1.08)
xfloor=int(n/1.08)
for i in range(xfloor,xceil+1):
    if int(i*1.08)==n:
        print(i)
        flag=False
        break
if flag:
    print(":(")

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define int long long
#define double long double
const int INF = (int)1e18 + 18;
const int maxn = (int) 1e6 + 6; 
using namespace std;

int a, b, k;

signed main() {

	cin >> a >> b;

	if(a == b){
		cout << a-1 << endl;
		return 0;
	}

	if( abs(a - b) % 2 == 1) cout << "IMPOSSIBLE" << endl;
	else cout << (abs(a-b))/2 + min(a,b) << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a_up = list(map(int, input().split()))
a_down = list(map(int, input().split()))
max = 0
for i in range(n):
    candy = 0
    candy += sum(a_up[:i+1])
    candy += sum(a_down[i:n])
    if candy > max:
        max = candy
print(max)


Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

var N int
var a []int
var tot = 0

func rec(n, x, y int) {
	if n == N-1 {
		tot = max(tot, x*a[n]+y)
		return
	}
	// buy
	rec(n+1, x+y/a[n], y%a[n])
	rec(n+1, 0, y+x*a[n])
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N = getInt()
	a = getInts(N)

	i := 0
	x := 0
	y := 1000
	for i < N-1 {
		pre := a[i]
		for i < N-1 && pre > a[i+1] {
			i++
			pre = a[i]
		}
		x = y / a[i]
		y = y % a[i]
		for i < N-1 && pre <= a[i+1] {
			i++
			pre = a[i]
		}
		y += x * a[i]
		x = 0
	}
	out(y)
	//rec(0, 0, 1000)
	//out(tot)
}


Measured memory_bytes: 1780
// https://atcoder.jp/contests/aising2019/tasks/aising2019_c
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

struct UnionFind {
  struct Node {
    ll parent;
    ll size;
  };
  vector<Node> tree;

  UnionFind(ll size) : tree(size) {
    for (ll i = 0; i < size; i++) {
      tree[i].parent = i;
      tree[i].size = 0;
    }
  }

  ll find(ll x) {
    if (tree[x].parent == x) {
      return x;
    } else {
      return tree[x].parent = find(tree[x].parent);
    }
  }

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

    if (tree[x].size < tree[y].size)
      swap(x, y);

    tree[y].parent = x;
    tree[x].size += tree[y].size;
  }

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

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

  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i, h) cin >> s[i];

  vi dx = {0, 0, 1, -1};
  vi dy = {1, -1, 0, 0};
  UnionFind uf(h*w);
  rep(i, h) rep(j, w) rep(k, 4) {
    int ni = i+dx[k];
    int nj = j+dy[k];
    if (0 <= ni && ni < h && 0 <= nj && nj < w && s[i][j] != s[ni][nj]) {
      uf.unite(i*w + j, ni*w + nj);
    }
  }

  vector<ll> black(h*w, 0), white(h*w, 0);
  rep(i, h) rep(j, w) {
    if (s[i][j] == '#') black[uf.find(i*w + j)]++;
    else white[uf.find(i*w + j)]++;
  }

  ll ans = 0;
  rep(i, h*w) {
    ans += black[i] * white[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<double,double> Pdouble;

const int INF = 2000000000;
const int MOD = 1000000007;

int main(){
  ll A,B,M;
  cin >> A >> B >> M;
  vector<int> a(A);
  vector<int> b(B);
  vector<vector<int>> m(M,vector<int>(3));
  for(int i=0; i<A; i++){
    cin >> a.at(i);
  }
  for(int i=0; i<B; i++){
    cin >> b.at(i);
  }

  for(int i=0; i<M; i++){
    for(int j=0; j<3; j++){
      cin >> m.at(i).at(j);
    }
  }

  ll min1 = a.at(m.at(0).at(0)-1) + b.at(m.at(0).at(1)-1)- m.at(0).at(2);
  for(int i=0; i<M; i++){
    ll sum = a.at(m.at(i).at(0)-1) + b.at(m.at(i).at(1)-1)- m.at(i).at(2);
    if(min1>=sum){
      min1 =sum;
    }
  }

  sort(a.begin(),a.end());
  sort(b.begin(),b.end());

  ll min2 = a.at(0) + b.at(0);

  cout << min(min1,min2) << endl;
}

Measured memory_bytes: 6528