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

namespace ABC131
{
    class E
    {
        static void Main(string[] args)
        {

            int[] a = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
            int N = a[0], K = a[1];

            int max = (N - 1) * (N - 2) / 2;


            if (K <= max)
            {

                List<int[]> edges = new List<int[]>();
                for (int i = 0; i < N - 1; i++)
                {
                    int[] e = { 1, i + 2 };
                    edges.Add(e);
                }

                List<int[]> noEdges = new List<int[]>();
                for (int i = 2; i < N; i++)
                {
                    for (int j = i + 1; j <= N; j++)
                    {
                        int[] e = { i, j };
                        noEdges.Add(e);
                    }
                }

                for (int i = 0; i < max - K; i++)
                {
                    int[] e = noEdges[i];
                    edges.Add(e);
                }

                Console.WriteLine(edges.Count);
                foreach(int[] e in edges)
                {
                    Console.WriteLine(e[0] + " " + e[1]);
                } 

            }
            else
            {
                Console.WriteLine(-1);
            }
        } 

    }
}


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

int main() {
  int N, K;
  long long cur = 1;
  cin >> N;
  cin >> K;
  for(int i=0;i<N;i++){
    long long d = cur * 2;
    long long a = cur + K;
    if (d < a) cur = d;
    else cur = a;
  }
  cout << cur << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
typedef long long ll;
const ll mod = 1000000007;
using namespace std;

int main()
{
    int S;
    cin >> S;
    vector<int> A(S), B(S);
    int cnt = 0;
    for (int i = 0; i < S; i++)
    {
        cin >> A[i] >> B[i];
    }
    for (int i = 1; i < S; i++)
    {
        if (A[i] == B[i] && A[i - 1] == B[i - 1])
        {
            cnt++;
        }
        else
        {
            cnt = 0;
        }
        if (cnt >= 2)
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n;
  cin >> n;

  ll dp[200010]={};
  for(ll i=1;i<10;i++)dp[i]=i;

  for(ll i=10;i<=n;i++){
    dp[i]+=dp[i-1];
    if(i%10==0)continue;
    ll e=0;
    while(pow(10,e)<i)e++;
    e--;
    if(i/((ll) pow(10,e))==i%10){
      dp[i]++;//iの頭と最後が同じ場合
      ll  j=i;
      j-=i/((ll) pow(10,e))*pow(10,e);
      j/=10;
      //cout << i << " " << j << endl;
      ll ep=e,a=0;
      if(i>=100){
        ep--;
        a++;
      }
      dp[i]+=2*((pow(10,ep)-1)/9+j+a);
      //cout << i << endl;
    }
    else if(i/((ll) pow(10,e))>i%10){
      dp[i]+=2*((pow(10,e)-1)/9);
    }
    else{
      dp[i]+=2*((pow(10,e-1)-1)/9);
    }
  }

  cout << dp[n] << endl;

}

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

int main ()
{
    string s;
    cin>>s;
    if(s=="SUN")
    cout<<7<<endl;
    if(s=="MON")
    cout<<6<<endl;
    if(s=="TUE")
    cout<<5<<endl;
    if(s=="WED")
    cout<<4<<endl;
    if(s=="THU")
    cout<<3<<endl;
    if(s=="FRI")
    cout<<2<<endl;
    if(s=="SAT")
    cout<<1<<endl;

    return 0;
}


Measured memory_bytes: 256
/*
	大号水?，拿来?手
	靠，没仔?看?，明?需要素数打表
*/
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;

int prime_table[1000000];

int Find_Number (int x)
{
	int cnt = 0;
	for (int i=2;i<=x;i++)
	{
		bool flag = false;
		for (int j=2;j<=sqrt((double)i);j++)
		{
			if ( i % j == 0)
			{
				flag = true;
				break;
			}
		}
		if (flag == false )
		{
			cnt++;
		}
		prime_table[i] = cnt;
	}
	return cnt;
}

int main ()
{
	int N;
	Find_Number (1000000);
	while (scanf("%d",&N)!=EOF)
	{
		cout<<prime_table[N]<<endl;
	}
	return 0;
}

Measured memory_bytes: 7056
#include<iostream>
using namespace std;
long long i,n,ans;
int main()
{
    while(cin>>n&&n)
    {
        ans=1;

    for(i=1;i<=n;i++)
    {
        ans=(ans*i)%1000000007;
        //if(ans>1000000007){
        //    cout<<"#############"<<i<<endl;
        //cout<<i<<" "<<ans%1000000007<<endl;
        //}
       // else


    }cout<<ans<<endl;

    }

}


Measured memory_bytes: 888
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  char c; cin >> c;
  char vo[5] = {'a', 'i', 'u', 'e', 'o'};
  
  string result = (find(vo,vo+5,c)!=vo+5) ? "vowel" : "consonant";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
int mod =1000000007;
const double PI = acos(-1);
int main(){
    int n;cin>>n;
    ll a[n];
    rep(i,n)cin>>a[i];
    ll now =0;
    ll ans =0;
    rep(i,n){
        if(now>a[i]){
            ans+=now-a[i];
        }
        now=max(now,a[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 5192
#include <bits/stdc++.h>
using namespace std;
 
const int DIM = 1e5 + 5;
 
int mxm[DIM], arr[DIM];
 
int main( void ) {
    
    int n, t;
    cin >> n >> t;
    
    int ans = 0, cnt = 0;
    for( int i = 1; i <= n; i ++ )
        cin >> arr[i];
    
    for( int i = n; i >= 1; i -- ) {
        mxm[i] = max( mxm[i + 1], arr[i] );
        arr[i] = mxm[i] - arr[i];
        
        if( ans < arr[i] ) {
            ans = arr[i];
            cnt = 1;
        } else
        if( ans == arr[i] )
            cnt ++;
    }
    
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 1024
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let n: usize = read();
    let mut ss = Vec::new();

    for _ in 0..n {
        ss.push(read::<usize>());
    }
    let ss_sum = ss.iter().sum::<usize>();
    let mut dp = vec![false; ss_sum + 1];
    dp[0] = true;

    for ni in 0..n {
        for si in (0..ss_sum + 1).rev() {
            if dp[si] {
                dp[si + ss[ni]] = true;
            }
        }
    }
    // println!("{:?}", dp);
    let mut ans = 0;
    for i in 0..dp.len() {
        if !dp[i] {
            continue;
        }
        if i % 10 != 0 {
            ans = std::cmp::max(ans , i);
        }
    }
    println!("{:?}", ans);
}


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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
void solve(){
    int n,k,ans=0;
    cin>>n>>k;
    n++;
    rep(i,k,n+1){
        int l=i*(i-1)/2;
        int r=n*(n-1)/2-(n-i)*(n-i-1)/2;
        ans=(ans+r-l+1)%hell;
    }
    cout<<ans<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
        

fast();
//ll t;cin>>t;while(t--)
{
    ll n;
    cin>>n;
    if(n>=400&&n<=599)
    {
        cout<<8<<endl;
    }
    else if(n>=600&&n<=799)
    {
        cout<<7<<endl;
    }
    else if(n>=800&&n<=999)
    {
        cout<<6<<endl;
    }
    else if(n>=1000&&n<=1199)
    {
        cout<<5<<endl;
    }
    else if(n>=1200&&n<=1399)
    {
        cout<<4<<endl;
    }
    else if(n>=1400&&n<=1599)
    {
        cout<<3<<endl;
    }
    else if(n>=1600&&n<=1799)
    {
        cout<<2<<endl;
    }
    else
    {
        cout<<1<<endl;

    }
}
return 0;
}

Measured memory_bytes: 3632
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define FAST_IO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 100000
#define endl "\n"
#define PI 3.14159265358979323846264338327950288
 
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;


int main(){
    FAST_IO ;
    string str ; cin >> str ;
    int N = ( int ) str.length() ;
    int sum = 0 ;
    for( int i = 0 ; i < N ; i++ ){
        int d = str[i] - '0' ;
        ( sum += d ) %= 9 ;
    }
    if( sum % 9 == 0 )
        cout << "Yes" << endl ;
    else
        cout << "No" << endl ;
    return 0 ;
}
 

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(a>0&&c>0){
        c-=b;
        if(c<=0){
            cout<<"Yes"<<endl;
            return 0;
        }
        a-=d;
        if(a<=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3632
a, v=gets.split.map &:to_i
b, w=gets.split.map &:to_i
t=gets.to_i
if a<=b
    x=a+t*v
    y=b+t*w
    puts (x>=y ? :YES : :NO)
else
    x=a-t*v
    y=b-t*w
    puts (x<=y ? :YES : :NO)
end


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

using namespace std;
using VI = vector<int>;
using VPI = vector<pair<int, int>>;
using LL = long long;

#define FOR(a,n) for(int i=a;i<n;i++)
#define rFOR(a,n) for(int i=n-1;i>=a;i--)
#define IN(n,a) for(int i=0;i<n;i++) cin>>a[i]
#define pIN(n,t) for(int i=0;i<n;i++){int a,b; cin>>a>>b; t.emplace_back(a,b);}
#define SORT(a) sort(a.begin(), a.end())
#define ALL(a) a.begin(), a.end()

char win(char s)
{
	if (s == 'r')return 'p';
	else if (s == 's') return 'r';
	else return 's';
}
char del(char a, char b)
{
	char s[3] = { 'r','s','p' };
	FOR(0, 3)
	{
		if (s[i] != a && s[i] != b)
		{
			return s[i];
		}
	}
}

int main()
{
	LL n, k, r, s, p, ans = 0;
	string t;

	cin >> n >> k >> r >> s >> p;
	cin >> t;

	vector<char> v(n);

	FOR(0, k)
	{
		if (t[i] == 'r')
		{
			v[i] = 'p';
			ans += p;
		}
		else if (t[i] == 's')
		{
			v[i] = 'r';
			ans += r;
		}
		else
		{
			v[i] = 's';
			ans += s;
		}
	}
	

	FOR(k, n)
	{
		if (win(t[i]) != v[i - k])
		{
			if (t[i] == 'r')
			{
				v[i] = 'p';
				ans += p;
			}
			else if (t[i] == 's')
			{
				v[i] = 'r';
				ans += r;
			}
			else
			{
				v[i] = 's';
				ans += s;
			}
		}
		else
		{
			if (i < n - k)
			{
				if (t[i] == win(t[i + k]))
				{
					v[i] = del(t[i], t[i - k]);
				}
				else
				{
					v[i] = t[i];
				}
			}
			else
			{
				v[i] = t[i];
			}
		}
	}
	cout << ans;
}

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

int main() 
{
    string s,t;
    cin>>s>>t;
    long int ans=0;
    for(long int i=0;i<s.length();i++)
    {
        if(s[i]!=t[i])
        ans++;
    }
    cout<<ans;
	return 0;
}


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

int main()
{

        string s;
        getline(cin, s);
        int len = s.length();
        for (int i = 0; i < len; ++i) {

                char c = s[i];
                if (c >= 'a' && c <='z') {
                        c = 'A' + (c - 'a');
                }
                else if (c >= 'A' && c <= 'Z') {
                        c = 'a' + (c  - 'A');
                }
                cout << c;

        }
        cout << endl;


}



Measured memory_bytes: 3152
#include <cmath>
#include <iostream>
using namespace std;
int main() {
    long long X, K, D; cin >> X >> K >> D;
    if (X < 0) X = -X;
    if (X / K >= D) cout << X - K * D << endl;
    else {
        long long x = X % D;
        long long ans = 1LL<<60;
        for (int t = -2; t <= 2; t++) {
            long long y = x + t * D;
            long long n = (x + t * D - X) / D;
            if ((n - K) % 2 == 0) ans = min(ans, abs(y));
        }
        cout << ans << endl;
    }
}

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

int main() {

	int a, b;
	scanf("%d %d", &a, &b);
	int ans = 0;
	for(int i = a; i <= b; i++) {
		char c[100000];
		int cnt = 0;
		sprintf(c, "%d", i);
		for(int j = 0; j < 2; j++) {
			if(c[j] == c[4 - j]) {
				cnt++;
			}
		}
		if(cnt == 2) {
			ans++;
		}
	}
	printf("%d\n", ans);
}

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

int main(){
  long long n,ans=0,a,tmp,d;
  cin >> n;
  cin >> tmp;

  for(int i=1;i<n;i++){
    cin >> a;
    if(tmp>a){
      d=tmp-a;
      tmp=a+d;
      ans+=d;
    }
    else tmp=a;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3580
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  cout << fixed << setprecision(10);
  double a,b;
  cin >> a >> b;
  complex<double> c = {a,b};
  cin >> a >> b;
  complex<double> d = {a,b};
  cout << abs(c-d) << endl;
}


Measured memory_bytes: 3312
#include<iostream>
#include<queue>
#include<vector>
#include<set>
#include<iomanip>

using namespace std;

const int INF = 1001001001;
const int MOD = 1000000007;

using ll = long long;

int main(){
	ll n, m; cin >> n >> m;
	ll a = 0;
	for (int i = 0;i < m;i++){
		ll tmp;cin >> tmp;
		a += tmp;
	}

	ll ans = n - a;
	if (ans < 0){
		cout << -1 << endl;
	}else{
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
long long pd[110];
long long GCD(long long a,long long b)
{
    if(a<b)
    {
        long long c;
        c=a;
        a=b;
        b=c;
    }
    return b==0?a:GCD(b,a%b);
}
int main()
{
    int n;
    while(cin>>n)
    {
        long long mn,sum=1;
        cin>>pd[0];
        mn=pd[0];
        for(int i=1;i<n;i++)
        {
            long long c;
            cin>>pd[i];
            if(GCD(pd[i],mn)==1)mn=mn*pd[i];
            else {
                c=GCD(pd[i],mn);
                mn=mn/c*pd[i];
            }
 
        }
 
        cout<<mn<<endl;
 
    }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
color_lst = [0 for i in range(9)]

color = 0
for i in range(len(a)):
    idx = a[i] // 400
    if idx > 8:
        idx = 8

    color_lst[idx] += 1
    if color_lst[idx] == 1 and idx != 8:
        color += 1

color_max = color + color_lst[8]
if color == 0:
        color += 1


print("{} {}".format(color, color_max))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main(int argc, char charv[])
{
  int X;
  cin >> X;
  
  int happy1000 = X/500;
  X -= happy1000*500;
  int happy5 = X/5;
  
  int happy = happy1000*1000 + happy5*5;
  cout << happy << endl;
  
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    int A[N];
    for (int i=0; i<N; i++){
        cin >> A[i];
    }
    for (int i=0; i<N; i++){
        if (A[i]%2==0){
            if (A[i]%3!=0 && A[i]%5!=0){
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <atcoder/modint>
#include <atcoder/lazysegtree>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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




using mint = atcoder::modint998244353;
const mint inv9 = mint(1)/9;

struct S{
    mint a, len;
    S(mint a=0, mint b=1): a(a), len(b){}
};

S op(S a, S b){
    return S{a.a * b.len + b.a, a.len * b.len};
}

S e(){return S();}

using F = int;

S mapping(F f, S x){
    if(f == 0) return x;
    return {(x.len - 1) * inv9 * f, x.len};
}

F composition(F f, F g){
    return (f == 0 ? g : f);
}

F id(){return 0;}






int main(){
    int N, Q; std::cin >> N >> Q;
    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(N);
    for(int i(0); i < N; ++i){
        seg.set(i, S{1, 10});
    }
  //  std::cout << seg.all_prod().a.val() << "\n";
    {
        int L, R, D;
        for(int i(0); i < Q; ++i){
            std::cin >> L >> R >> D;
            seg.apply(L-1, R, D);
            std::cout << seg.all_prod().a.val() << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 9868
import math
N = int( input())
temp = list(map(int,input().split(" ")))
temp.sort()
def GCD( a,  b ):
    if b == 0:
        # print("--" * 10)
        return a
    else:
        # print(b)
        return GCD(b, a % b)
ans = [GCD(temp[0],temp[1])]
for i,num in enumerate(temp[2:]):
    ans.append(GCD(ans[i],num))

print(ans[-1])

Measured memory_bytes: 15020
// C - Different Strokes

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	vector<pair<int, int>> P(N);

	for (int i=0; i<N; i++) {
		int A, B;
		cin >> A >> B;
		P[i] = make_pair(A, B);
	}

	sort(P.begin(), P.end(), [](const pair<int, int> &a, const pair<int, int> &b) {
		return a.first + a.second > b.first + b.second;
	});

	// **** debug ****
	/*
	for (int i=0; i<N; i++) {
		cout << P[i].first << " " << P[i].second << endl;
	}
	*/

	ll ans = 0;

	for (int i=0; i<N; i++) {
		if (i % 2 == 0) ans += P[i].first;
		else ans -= P[i].second;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3976
require 'prime'
def solve(arr, v)
  l = -1
  r = arr.size
  while l + 1 < r
    m = (l + r) / 2
    if arr[m] < v then l = m
    else r = m
    end
  end
  arr[r] - arr[l]
end
primes = Prime.each.take(100000)
while n = gets.to_i
  break if n == 0
  puts Prime.prime?(n) ? 0 : solve(primes, n)
end

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

int main(){
    int N;  cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; i++) cin >> a[i];

    int ans = 0;
    for(int i=0; i<N; i++){
        int cnt = 1;
        while(i<N-1 && a[i+1]==a[i]){
            cnt++;
            i++;
        }
        ans += cnt/2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
temparr = input()
temparr = temparr.split()
n = int(temparr[0])
items = int(temparr[1])
temparr = input()
temparr = temparr.split()
arr = []
for i in temparr:
    arr.append(int(i))
arr = sorted(arr)
total = 0 
items -= 1 
for i,j in enumerate(arr):
    total += j
    if i == items:
        break
print(total)

Measured memory_bytes: 62320
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <map>
#include <numeric>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long ll;
typedef vector<long long int> vi;
typedef vector<long long int>::iterator vit;

int main(){
	int n,c = 0;
	int a[110] = {};
	while (cin >> n){
		a[n]++;
		if (c < a[n]){
			c++;
		}
	}
	REP(i, 100){
		if (a[i] == c){
			cout << i << "\n";
		}
	}
}

Measured memory_bytes: 1156
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int a;
	int b;
	cin>>a>>b;
	cout << a*b<<" "<<a+b+a+b<< endl;
	return 0;
}

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

public class MainClarss
{
	public const long Giri = 1000000007;
	
	class Term
	{
		public int Start{get;set;}
		public int End{get;set;}
		public bool Right{get;set;}
	}
	
	public static void Main(string[] args)
	{
		int a = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();
		
		if(a>=3200) 
		{
			Console.WriteLine(s);
		}
		else
		{
			Console.WriteLine("red");
		
		}
	}

	
	
	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	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));
	}

}



Measured memory_bytes: 11092
#include<cstdio>
#include<functional>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cctype>
#define MM 0
#define rep(i,a) for(int i=0;i<a;i++)
#define rep2(i,a) for(int i=1;i<=a;i++)
#define rep3(i,a) for(int i=1;i<a;i++)
#define rep4(i,a) for(int i=0;i<=a;i++)
using namespace std;
int dp[101][4][4];
long long int sum;
int main(void)
{
	int x,y;
	int day,al,sosu[101]={MM};
	cin>>day>>al;
	rep(i,al) {cin>>x>>y;sosu[x]=y;}
	dp[MM][MM][MM]=1;
	rep2(i,day)rep(j,4)rep(k,4)rep3(kk,4) {
		if((j!=k || k!=kk)&&(sosu[i]==MM || sosu[i]==kk)) {
            dp[i][k][kk]+=dp[i-1][j][k];
            dp[i][k][kk]%=10000;
		}
	}
	sum=0;
	rep2(i,3)rep4(j,3) sum+=dp[day][i][j];
	int sm;
	sm=sum%10000;
	cout<<sm<<endl;
	return 0;
}

Measured memory_bytes: 3076
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x,n) rep(__i,n) pri(x,__i);
#define prar(x,b,e) repr(__i,b,e) pri(x,__i);

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

ll MOD = 1000000007;

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

int main() {
	string s;
	cin >> s;
	cout << s.substr(0, s.size() - 8) << endl;
	return 0;
}


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

for _ in range(n):
    a = list(map(int, input().split()))
    value = c
    for i in range(m):
        value += a[i]*b[i]
    if value > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n , k;
	cin >> n;
	cin >> k;
	//ll dis;
	//cout << max(n, k) << " " << min(n, k) << endl;
	//ll mn = min(n, k);
	//ll mx = max(n, k);
	ll temp = min(n%k, k-n%k);
	cout << temp << endl;
	//dis = abs(temp*mn - mx);
	//cout << dis << endl;
	return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define MAX 90001
typedef long long ll;
int main(){
	int h,w,d;
	cin >> h>>w>>d;
	//int s = h*w;
	int **a = new int*[MAX];
	rep(i,MAX){
		a[i] = new int[2];
	}
	a[0][0]=a[0][1]=0;
	int sub;
	rep(i,h){
		rep(j,w){
			cin >> sub;
			a[sub][0] = i;
			a[sub][1] = j;
		}
	}

	int q;
	cin >> q;
	int f[MAX] = {};
	rep(i,MAX){
		if (i<=d) f[i]=0;
		else {
			int k = i-d;
			f[i] = f[k] + abs(a[i][0]-a[k][0]) + abs(a[i][1]-a[k][1]);
		}
	}

	int l,r;
	rep(i,q){
		cin >> l>>r;
		cout << f[r] - f[l] <<endl;
	}
	return 0;
}



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



int main(){
    string S,T;
    cin >> S >> T;
    int ans = 0;
    for (int i = 0; i < 3; i++)
    {
        if(S[i] == T[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
x=list(map(int,input().split()))
ans=10**9
for i in range(N-K+1):
    if min(abs(x[i])+abs(x[i]-x[i+K-1]),abs(x[i+K-1])+abs(x[i]-x[i+K-1]))<ans:
        ans=min(abs(x[i])+abs(x[i]-x[i+K-1]),abs(x[i+K-1])+abs(x[i]-x[i+K-1]))
print(ans)

Measured memory_bytes: 14780
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

//const double PI = 3.1415926535897932384626433832795;

int main() {
  map<string, int> mp;
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  mp[s] = a;
  mp[t] = b;
  mp[u] -= 1;
  cout << mp[s] << ' ' << mp[t] << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,avx2,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0)
typedef long long ll;


ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

//#######################################

int main(){
  boost;

  int x,y,z;
  cin>>x>>y>>z;
  cout<<z<<" "<<x<<" "<<y;
}



Measured memory_bytes: 3640
import java.io.*;
import java.util.*;
import java.lang.*;

class Main {

	public static void main(String[] args) {
		final FastScanner sc = new FastScanner(System.in);
		double a = sc.nextInt();
		double b = sc.nextInt();
		double h = sc.nextInt();
		double m = sc.nextInt();
		double arad = -h * Math.PI / 6.0 - (m * Math.PI / 360) + Math.PI / 2;
		double brad = -m * Math.PI / 30.0 + Math.PI / 2;

		double ax = a * Math.cos(arad);
		double ay = a * Math.sin(arad);

		double bx = b * Math.cos(brad);
		double by = b * Math.sin(brad);

		double dx = ax - bx;
		double dy = ay - by;
		System.out.println(Math.sqrt(dx * dx + dy * dy));
	}

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte()) return buffer[ptr++];
			else return -1;
		}

		private static boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

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


Measured memory_bytes: 25452
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int R, S, P;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> R >> S >> P;
    vector<int> cost;
    rep(p, 0, P) {
        int i, j; cin >> i >> j;
        
        int cst = 0;

        // 縦
        cst += R - i + 1;

        // 横
        if (j <= S) cst += S - j + 1;
        else cst += j - S;

        cost.push_back(cst);
    }
    sort(all(cost));

    int ans = 0;
    fore(c, cost) {
        ans++;
        chmax(ans, c);
    }
    cout << ans << endl;
}



Measured memory_bytes: 4844
#include <bits/stdc++.h>
//#include <boost/range/algorithm/find_if.hpp>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
const int INF = 999999999;

int main(){
    int H, W;
    cin >> H >> W;
    vector<vector<char>> board(H, vector<char>(W));
    vector<bool> hb(H, false);
    vector<bool> wb(W, false);
    rep(i, H){
        rep(j, W){
            cin >> board[i][j];
            if(board[i][j] == '#'){
                hb[i] = true;
                wb[j] = true;
            }
        }
    }
    rep(i, H){
        if(hb[i] == true){
            rep(j, W){
                if(wb[j] == true){
                    cout << board[i][j];
                }
            }
            cout << endl;
        }
    }
return 0;}
/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int N, M;
	int h[1500][1500] = { 0 }, l[1500] = { 0 }, t[1500] = { 0 };
	cin >> N >> M;
	for (int i = 0; i < N; i++){
		cin >> l[i];
	}
	for (int j = 0; j < M; j++){
		cin >> t[j];
	}
	for (int j = 0; j < N; j++){
		for (int i = j; i < j + M-N+1; i++){
			if (j == 0){
				h[j][i] = l[j] * t[i];
				if (h[j][i] >= h[j][i - 1] && i != 0){
					h[j][i] = h[j][i - 1];
				}
			}
			else{
				h[j][i] = h[j - 1][i - 1] + l[j] * t[i];
				if (h[j][i] >= h[j][i - 1] && i != j){
					h[j][i] = h[j][i - 1];
				}
			}
		}
	}
	cout << h[N - 1][M - 1] << endl;
	return 0;
}

Measured memory_bytes: 11884
import sys
from collections import deque
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
n, m = map(int, input().split())
memo = set(list(range(n)))
E = [[] for i in range(n)]
for i in range(m):
    x, y, z = map(int, input().split())
    E[x-1].append(y-1)
    E[y-1].append(x-1)
def dfs(cur, pre):
    stack = deque([[cur, pre]])
    while stack:
        cur, pre = stack.pop()
        memo.discard(cur)
        for e in E[cur]:
            if e != pre and e in memo:
                stack.append([e, cur])
ans = 0
for i in range(n):
    if i in memo:
        dfs(i, -1)
        ans += 1
print(ans)


Measured memory_bytes: 71268
import java.util.Scanner

object Main extends App {

  def readALine(c:Int, ac:List[Long]=Nil):List[Long] =
    if (c > 0) readALine(c-1, sc.nextLong::ac) else ac.reverse
  // def readLines(r:Int, c:Int, ac:List[List[Int]]):List[List[Int]] =
  //   if (r > 0) readLines(r-1, c, readALine(c, Nil)::ac) else ac.reverse
  val sc = new Scanner(System.in)
  val N,M = sc.nextInt
  val K = sc.nextLong
  val Ai = readALine(N)
  val Bi = readALine(M)
  val Zero:Long = 0L

  def find(array:Array[Long], key:Long):Int = {
    require(!array.isEmpty,"Array must have elements.")
    def iter(l:Int, r:Int):Int = {
      if (l == r) if (array(l) > key) l-1 else l
      val bound = (l+r)>>1
      // if (bound > 200000) println(s"l:$l r:$r bound:$bound key:$key")
      array(bound) match {
        case v if v > key => if (array(bound-1) < key) bound-1 else iter(l, bound-1)
        case v if v < key => if (array(bound+1) > key) bound else iter(bound+1, r)
        case _ => bound
      }
    }

    val maxIdx = array.length-1
    key match {
      case k if k > array(maxIdx) => maxIdx
      case k if k < array(0) => -1
      case _ => iter(0, array.length-1) 
    }
  }

  def solver():Int = {
    def acumulate(list:List[Long], ac:List[Long]):List[Long] =
      if (list.isEmpty) ac
      else if (ac.isEmpty) acumulate(list.tail,list.head::ac)
      else acumulate(list.tail,(ac.head+list.head)::ac)
    val cumAi = acumulate(Zero::Ai, Nil).reverse.toArray
    val cumBi = acumulate(Zero::Bi, Nil).reverse.toArray
 
    // println(cumAi.mkString(","))
    // println(cumBi.mkString(","))
 
    def iter(i:Int, max:Int):Int = {
      if (i < cumAi.length && cumAi(i) <= K) {
        val j = find(cumBi, K - cumAi(i))
        // println(s"i:$i j:$j max:$max")
        if (i+j > max) iter(i+1, i+j) else iter(i+1, max)
      } else max
    }
    iter(0, 0)
  }

  println(solver())

}

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

int main() {
  size_t N;
  cin >> N;
  size_t n = N;
  vector<size_t> a;
  while(n > 0){
    a.push_back((n - 1) % 26);
    n = (n - 1) / 26;
  }
  for(int i = a.size() - 1;i >= 0;--i){
    cout << (char)('a' + a[i]);
  }
  cout << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  ll n, k;
  cin >> n >> k;
  if(k == 0){
    cout << n*n << endl;
    return 0;
  }
  ll ans = 0;
  for(ll i = k+1; i < n+1; i++){
    ll add = n / i;
    add *= i - k;
    ll add2 = n % i;
    // cerr << i << " " << add << " " << add2 << endl;
    if(add2 >= k) add += add2 - k + 1;
    ans += add;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    string s,t; cin >> s >> t;
    int ss = SIZE(s); int st = SIZE(t);
    if(ss > st) cout << "GREATER" << endl;
    else if(ss == st){
        rep(i,ss){
            if(s[i]-'0' > t[i]-'0'){
                cout << "GREATER" << endl;
                return 0;
            }
            else if(s[i]-'0' < t[i]-'0'){
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
    else cout << "LESS" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;
string s;
int a[4] = {};

int main() {
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'N')
			a[0]++;
		else if (s[i] == 'S')
			a[1]++;
		else if (s[i] == 'W')
			a[2]++;
		else
			a[3]++;
	}
	if (a[0] == 0 && a[1] > 0) {
		cout << "No" << endl;
		return 0;
	}
	if (a[1] == 0 && a[0] > 0) {
		cout << "No" << endl;
		return 0;
	}
	if (a[2] == 0 && a[3] > 0) {
		cout << "No" << endl;
		return 0;
	}
	if (a[3] == 0 && a[2] > 0) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define repi(i, a, b) for (int i = (a); i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = long long;
using u32 = unsigned long long;
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using vi32 = vector<i32>;
using vu32 = vector<u32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf64 = vector<f64>;
using vstr = vector<string>;
using vvi32 = vector<vi32>;
using vvu32 = vector<vu32>;
using vvi64 = vector<vi64>;
using vvu64 = vector<vu64>;
using vvf64 = vector<vf64>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  string s;
  cin >> s;
  int ans = 0;
  int c = 0;
  rep(i, s.size()) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      c++;
      amax(ans, c);
    } else {
      c = 0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(s) int(s.size())
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int dp[3010][3010],MOD=998244353,n,a[3010];

int sum(int a, int b){int ans=a+b; if(ans>=MOD)ans-=MOD;return ans;}
int mul(ll a, ll b){return a*b%MOD;}

int solve(int pos, int rem){
	if(pos==n)return rem==0;
	int &r=dp[pos][rem];
	if(r>=0)return r;
	//no subset
	r=solve(pos+1,rem);
	//si subset
	r=sum(r,solve(pos+1,rem));
	if(a[pos]<=rem) r=sum(r,solve(pos+1,rem-a[pos]));
	return r;
}

int main(){FIN;
	//int n; cin>>n;
	//vector<int> a(n),b(n);
	//fore(i,0,n) cin>>a[i]>>b[i];
	int k; cin>>n>>k;
	fore(i,0,n) cin>>a[i];
	memset(dp,-1,sizeof(dp));
	cout<<solve(0,k)<<"\n";
}

Measured memory_bytes: 39176
def c(num):
    cnt=0
    while num>0:
        num//=10
        cnt+=1
    return cnt

def main():
    n=int(input())
    ans=10**10
    for i in range(1,int(n**0.5)+1):
        if n%i!=0:
            continue
        b=n//i
        ret=max(c(i),c(b))
        if ans>ret:
            ans=ret
    print(ans)

main()

Measured memory_bytes: 3060
A, B, K = map(int, input().split())

if A + B >= K:
    if A >= K:
        x = A - K
        y = B
    if A < K:
        x = 0
        y = B - K + A
if A + B < K:
    x = 0
    y = 0
print('{} {}'.format(x, y))

Measured memory_bytes: 3060
fun main(args: Array<String>) {
  val S = readString()
  val result = when (S) {
    "SUN" -> 7
    "MON" -> 6
    "TUE" -> 5
    "WED" -> 4
    "THU" -> 3
    "FRI" -> 2
    "SAT" -> 1
    else -> 0
  }
  println(result)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(' ')
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }


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

ll arr[200020];
int main() {
	ll n, ans = 0, curr = 0;
	scanf("%lld",&n);
	for(ll i=0; i<n; i++) {
		scanf("%lld",arr+i);
		if(arr[i]>curr) {
			curr = arr[i];
		}
		else {
			ans+=curr-arr[i];
		}
	}
	printf("%lld",ans);
}	



Measured memory_bytes: 5320
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
ll sum = 0,ans,n,k,cnt =0,r,c,d,ma,mi; 
int main() {
    cin >> n >> k; sum = (n / 3 + 1) * k - (n / 3) * k;
    sum = min((k / 3 + 1) * n - (k / 3) * n, sum);
    if (n % 3 == 0 || k % 3 == 0) {
        cout << 0 << endl;
        return 0;
    }
    else {
        req(i, n - 1) {
            r = i * k;
            c = (n - i) * (k / 2 + k % 2);
            d = (n - i) * (k / 2);
            ma = max(r, max(c, d));
            mi = min(r, min(c, d));
            sum = min(sum, ma - mi);
        }
        req(i, k - 1) {
            r = i * n;
            c = (k - i) * (n / 2 + n% 2);
            d = (k - i) * (n / 2);
            ma = max(r, max(c, d));
            mi = min(r, min(c, d));
            sum = min(sum, ma - mi);
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
char r[51][51]; int H, W, Q, a[2601], b[2601], c[2601], d[2601], T; vector<int>x[2601], u[2601]; pair<int, int>dist[2601];
void Goto(int p1, int p2) {
	for (int i = 0; i < H*W; i++)dist[i] = make_pair(1 << 30, 1 << 30);
	queue<int>Q; Q.push(p1); dist[p1] = make_pair(0, 1 << 30); int p3 = p2;
	while (!Q.empty()) {
		int a1 = Q.front(); Q.pop();
		for (int i : x[a1]) {
			if (dist[i].first > dist[a1].first + 1) { dist[i] = make_pair(dist[a1].first + 1, a1); Q.push(i); }
		}
	}
	while (p2 != p1) { u[p2].push_back(T + dist[p2].first); p2 = dist[p2].second; }
	T += dist[p3].first;
}
int main() {
	cin >> H >> W >> Q;
	for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++)cin >> r[i][j]; } for (int i = 0; i < H*W; i++)cin >> a[i]; for (int i = 0; i < H*W; i++)cin >> b[i]; for (int i = 0; i < H*W; i++)cin >> c[i];
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			int dx[4] = { -1,0,1,0 }, dy[4] = { 0,1,0,-1 };
			for (int k = 0; k < 4; k++) {
				int ex = i + dx[k], ey = j + dy[k];
				if (ex < 0 || ey < 0 || ex >= H || ey >= W || r[ex][ey] == '#' || r[i][j] == '#')continue;
				x[i*W + j].push_back(ex*W + ey); x[ex*W + ey].push_back(i*W + j);
			}
		}
	}
	for (int i = 0; i < Q; i++) { int ax, bx; cin >> ax >> bx; d[i] = ax*W + bx; }
	u[d[0]].push_back(0); int ret = 0; for (int i = 0; i < Q - 1; i++) { Goto(d[i], d[i + 1]); }
	for (int i = 0; i < H*W; i++) {
		if (u[i].size() >= 1)ret += b[i] + c[i];
		for (int j = 0; j < (int)u[i].size() - 1; j++) {
			if ((u[i][j + 1] - u[i][j])*a[i] >= b[i] + c[i]) { ret += b[i] + c[i]; }
			else { ret += (u[i][j + 1] - u[i][j])*a[i]; }
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 8096
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a;

int main()
{
	ll a;
	ll b;
	cin >> a >>b;
	
	cout << a*b << endl;
	
	return 0;
}


Measured memory_bytes: 3624