akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int w,h;
    cin >> w >> h;
    vi p(w),q(h);
    cin >> p >> q;
    int row = h+1,col = w+1;
    vp v;
    rep(i,w) v.eb(p[i],0);
    rep(i,h) v.eb(q[i],1);
    sort(all(v));
    ll ans = 0;
    for(auto [c,k] : v) {
        if(k == 0) {
            ans += (ll)c*row;
            col--;
        } else {
            ans += (ll)c*col;
            row--;
        }
    }
    cout << ans << endl;
}


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

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

    vector<int> vec(n);
    for(int i=0;i<n;i++){
        cin >> vec.at(i);
    }

    int count = 0;
    while(1){
        for(int i=0;i<n;i++){
            if(vec.at(i)%2==1) goto END;
            else vec.at(i) /= 2;
        }
        count++;
    }
END:
    cout << count << endl;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n,x;
	int a[1000];
	int ans=0;
	int t=0;

	scanf("%d%d",&n,&x);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n+1;i++){
		a[0] = 0;
		if(ans>x){
			break;
		}
		ans=ans+a[i+1];
		t++;

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

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

using namespace std;

//#define _FILES
#define PB push_back
#define MP make_pair
#define X first
#define Y second

const int MAXN = 1000;
int f[MAXN][MAXN];
bool v[MAXN][MAXN];

void dfs(int x,int y)
{
    v[x][y] = true;
    if (f[x+1][y])
    {
        dfs(x+1, y);
        return;
    }

    if (f[x][y+1])
    {
        dfs(x, y+1);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);

    #ifdef _FILES
        freopen("","r",stdin);
        freopen("","w",stdout);
    #endif // _FILES
    int n, m;
    cin >> n >> m;
    for (int i=1;i<=n;i++)
    {
        string s;
        cin >> s;
        for (int j=0;j<m;j++)
        {
            if (s[j] == '#') f[i][j+1] = 1;
        }
    }
    dfs(1, 1);

    string ans = "Possible";
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=m;j++)
        {
            if ((f[i][j]) && (!v[i][j]))
            {
                ans = "Impossible";
            }
        }
    }
    cout << ans << endl;
    return 0;
}



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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n,xx,yy,hh;
	cin >> n;
	vll x(n),y(n),h(n);
	rep(i,n){
		cin >> x[i] >> y[i] >> h[i];
		if(h[i]>0){
			xx=x[i];
			yy=y[i];
			hh=h[i];
		}
	}
	rep(i,101){
		rep(j,101){
			bool b=true;
			ll tmp=abs(i-xx)+abs(j-yy)+hh;
			for(ll k=0;k<n;k++){
				if(max(tmp-abs(i-x[k])-abs(j-y[k]),0LL)!=h[k]){
					b=false;
				}
			}
			if(b){
				cout << i << " " << j << " " << tmp << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = (int)(1e9+7);
main(){
  bool b[1000];
  memset(b,1,sizeof(b));
  b[0]=b[1]=0;
  for(int i=2;i<32;i++){
    for(int j=2*i;j<1000;j+=i){
      b[j]=0;
    }
  }
  vector<int> p;
  for(int i=0;i<1000;i++){
    if(b[i])p.push_back(i);
  }
  int n;cin>>n;
  int res=1;
  for(auto i:p){
    int t=1;
    for(int j=1;j<10;j++){
      t+=n/(int)pow(i,j);
    }
    res=(res*t)%mod;
  }
  cout<<res<<endl;
  return 0;
}

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

// #define int ll
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define fastio    ios::sync_with_stdio(0); cin.tie(0)
#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp        make_pair
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second

int inf(0x3fffffff);
int mod(1000000007);
double pi(acos(-1.0));

int32_t main() {
  fastio;
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif

  int a, b;
  cin >> a >> b;
  cout << a * b;

  return 0;
}


Measured memory_bytes: 3560
N,M,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
ans = "War"
for i in range(X+1,Y):
    if max(x) < i and min(y) >= i:
        ans = "No War"
        break
print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int a,b,c;
  cin>>a>>b>>c;
  cout<<std::max(c-(a-b),0)<<endl;

  return 0;
}


Measured memory_bytes: 256
def main():
  import sys
  _int = int
  n = _int(input())
  a = [_int(e) for e in input().split()]
  b = [_int(e) for e in input().split()]
  result = 0
  q = [i for i in range(n) if b[i] != a[i]]
  while len(q) != 0:
    nq = []
    c = 0
    for i in q:
      if i == 0 or i == n - 1:
        j = b[(n + i - 1) % n] + b[(n + i + 1) % n]
      else:
        j = b[i - 1] + b[i + 1]
      if j > b[i] - a[i]:
        nq.append(i)
        continue
      c += 1
      k = (b[i] - a[i]) // j
      result += k
      b[i] -= j * k
      if a[i] != b[i]:
        nq.append(i)
    if c == 0 and len(nq) != 0:
      print(-1)
      sys.exit()
    q = nq
  print(result)
main()

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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

template<int64 mod>
struct ModInt{
  int64 x;
  constexpr ModInt(int64 y = 0):x((y%mod+mod)%mod){}
  constexpr ModInt& operator+=(const ModInt& a){
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt& operator-=(const ModInt& a){
    if((x -= a.x) < 0)x += mod;
    return *this;
  }
  constexpr ModInt& operator*=(const ModInt& a){
    x = x * a.x % mod;
    return *this;
  }
  constexpr ModInt& operator/=(const ModInt& a){
    *this *= a.inv();
    return *this;
  }
  constexpr ModInt operator-() const {
    return ModInt(-x);
  }
  constexpr ModInt operator+(const ModInt& a) const {
    return ModInt(*this) += a;
  }
  constexpr ModInt operator-(const ModInt& a) const {
    return ModInt(*this) -= a;
  }
  constexpr ModInt operator*(const ModInt& a) const {
    return ModInt(*this) *= a;
  }
  constexpr ModInt operator/(const ModInt& a) const {
    return ModInt(*this) /= a;
  }
  constexpr ModInt operator++(){
    *this += ModInt(1);
    return *this;
  }
  constexpr ModInt operator++(int){
    ModInt old = *this;
    ++*this;
    return old;
  }
  constexpr ModInt operator--(){
    *this -= ModInt(1);
    return *this;
  }
  constexpr ModInt operator--(int){
    ModInt old = *this;
    --*this;
    return old;
  }
  constexpr bool operator==(const ModInt& a) const {
    return x == a.x;
  }
  constexpr bool operator!=(const ModInt& a) const {
    return x != a.x;
  }
  constexpr ModInt pow(int64 r) const {
    if(!r)return 1;
    ModInt res = pow(r>>1);
    res *= res;
    if(r & 1) res *= *this;
    return res;
  }
  constexpr ModInt inv() const {
    return pow(mod-2);
  }
  friend istream& operator>>(istream& is, ModInt& a){
    int64 t;
    is >> t;
    a = ModInt(t);
    return is;
  }
  friend ostream& operator<<(ostream& os, const ModInt& a){
    return os << a.x;
  }
};
using mint = ModInt<MOD>;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  vector<mint> a(n);
  REP(i,n)cin >> a[i];
  mint ans = 0;
  REP(i,n)ans += a[i];
  ans *= ans;
  REP(i,n)ans -= a[i] * a[i];
  ANS(ans/2);
  return 0;
}

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

using namespace std;

/**
 *  Name: Chris M. Perez
 *  University: Interamerican University Metro Campus
 *
**/

#define endl '\n'
#define MOD 10E9
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define gcd(x , y) __gcd(x , y)
#define all(x) (x).begin() , (x).end()
#define forn(i , a , b) for(int i=(a);i<(b);i++)
#define forrange(j , a , b) for(int j=(a);j<=(b);j++)
#define nestedforn(i , a , b , j , c , d) for(int i=(a);i<=(b);i++) for(int j=(c);j<=(d);j++)
#define sort_all(x) sort(all(x))
#define zeros_at_beginning(x) __builtin_clz(x)
#define zeros_at_end(x) __builtin_ctz(x)
#define ones(x) __builtin_popcount(x)
#define parity_even_or_odd_ones __builtin_parity(x)

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef tuple<int , int , int> tiii;
typedef vector<pii> vpii;
typedef vector<tiii> vtiii;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long long ll;
typedef long long int lli;

             
inline int input(){
  int n;
  scanf("%d" , &n);
  return n;
}

template<typename T>
bool maxn(T &a, const T &b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}
                    
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;  

#ifdef LOCAL_DEFINE
  freopen("input.txt" , "rt" , stdin);
#endif
  
  string s; cin >> s;
  set<char> ss = {'A' , 'C' , 'G' , 'T'};
  ll sol = 0;
  ll size = s.length();
  nestedforn(i , 0 , (ll)size , j , 0 , (ll)size){ 
    string k = s.substr(i , j - i + 1);
    //cout << k << endl;
    bool ok = true; 
    for(auto chars: k){ 
      if(ss.find(chars) == ss.end()){
        ok = false;
        break;
      }
    }
    if(ok) maxn(sol , (ll)k.length());
    
  } 
  cout << sol << endl;
        
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif  
  return 0;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    ll n; cin >> n;

    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i];
    }

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

    ll left = -1;
    ll right = n-1;

    while (right - left > 1) {
        ll mid = (left + right) / 2;

        bool ok = true;
        ll size = 0;
        for (ll i = 0; i < mid; ++i) {
            size += a[i];
        }

        for (ll i = mid; i < n-1; ++i) {
            size += a[i];

            if (a[i+1] > 2 * size) {
                ok = false;
                break;
            }
        }

        if (ok) {
            right = mid;
        } else {
            left = mid;
        }
    }

    cout << n - right << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

struct Student
{
	int id;
	int before;

	bool operator<(Student &t)const
	{
		return before < t.before;
	}
};

Student student[100005];

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		student[i].id = i + 1;
		cin >> student[i].before;
	}
	sort(student, &student[n]);

	for (int i = 0; i < n; i++)
		cout << student[i].id << " ";

}

Measured memory_bytes: 1536
import java.util.*;
class Main{
	public static void main(String[] args) {
	     Main app = new Main();
             app.solve();
	}
	void solve(){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.print(a * b + " ");
		System.out.println(2 * (a + b));
	}
}


Measured memory_bytes: 26184
N = int(input())
s = [ input() for _ in range(N) ]
M = int(input())
t = [ input() for _ in range(M) ]

max_point = 0
for string in s:
    point = 0
    for i in s:
        if i == string:
            point += 1
    for j in t:
        if j == string:
            point -= 1
    if point > max_point:
        max_point = point
print(max_point)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b;
    if(a>=10)
    {
        cout<<b<<endl;
    }
    else
    {
      c=100*(10-a);
      cout<<c+b<<endl;
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class a{
    public static void Main(){
        string[] str = Console.ReadLine().Split(' ');
        int L = int.Parse(str[0]);
        int R = int.Parse(str[1]);
        int d = int.Parse(str[2]);
        int ans = 0;
        for(int i=L; i<=R; i++){
            if(i%d == 0){
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
}


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

using namespace std;

int main() {
	
	int A[30] = {};
	
	int a;
	for(int i=0;i<28;i++) {
	cin >> a;
	A[a-1]++;
}
	for(int i=0;i<30;i++)
	if( A[i] == 0)
	cout << i+1 << "\n";

	return 0;
}


Measured memory_bytes: 3092
#include <iostream>

using namespace std;

//BEGIN
template <typename T>
T extGCD(T a, T b, T& x, T& y) { //ax+by=gcd(a,b)
	if (b == 0) {
		x = 1; y = 0;
		return a;
	}
	T d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

template <typename T>
T mod_inverse(T a, T mod) { //a,modは互いに素
	T x, y;
	extgcd(a, mod, x, y);
	return (x % mod + mod) % mod;
}
//END

int main() {
	int a, b, x, y; cin >> a >> b;
	extGCD(a, b, x, y);
	cout << x << " " << y << endl;
		
	return 0;
}


/*
	created: 2019-08-29
	https://onlinejudge.u-aizu.ac.jp/courses/library/6/NTL/1/NTL_1_E
*/


Measured memory_bytes: 3100
use std::io;
use std::cmp;


fn main() {
    let (x, y) = {
        let i = read::<usize>();
        (i[0], i[1])
    };
    // n + 2m = x, 2n + m = y
    // m = (2x - y) / 3
    // n = (2y - x) / 3
    if (x + y) % 3 != 0 { println!("0"); return; }
    let m = Modulo::new(1_000_000, 1_000_000_007);
    println!("{}", m.comb((x + y) / 3, (2 * cmp::max(x, y) - cmp::min(x, y)) / 3));
}

pub struct Modulo {
    fact: Vec<usize>,
    inv_fact: Vec<usize>,
    modulo: usize
}

impl Modulo {
    pub fn new(n: usize, modulo: usize) -> Self {
        let mut fact = vec![0; n + 1];
        let mut inv = vec![0; n + 1];
        let mut inv_fact = vec![0; n + 1];
        inv[1] = 1;
        for i in 2..n + 1 {
            inv[i] = inv[modulo % i] * (modulo - modulo / i) % modulo;
        }
        fact[0] = 1;
        inv_fact[0] = 1;
        for i in 0..n {
            fact[i + 1] = fact[i] * (i + 1) % modulo;
        }
        for i in 0..n {
            inv_fact[i + 1] = inv_fact[i] * inv[i + 1] % modulo;
        }
        Modulo { fact: fact, inv_fact: inv_fact, modulo: modulo }
    }

    pub fn comb(&self, n: usize, r: usize) -> usize {
        if n < r { return 0; }
        self.fact[n] * self.inv_fact[r] %
            self.modulo * self.inv_fact[n - r] % self.modulo
    }
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 28924
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	if((a-b) % 2 == 0){
		printf("Alice\n");
	}
	else{
		printf("Borys\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<array>

using namespace std;

int main(){
    array<int, 20>p;
    int n,count = 0;
    cin>>n;
    for(int i = 0; i < n; i++){
        cin>>p.at(i);
    }
    for(int i = 0; i < n - 2; i++){
        if((p.at(i)-p.at(i+1))*(p.at(i+1)-p.at(i+2)) > 0){
            count++;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <random>
using namespace std;
#define ll long long int 
#define ii pair<int ,int >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1(x,n) for(int x = 1; x <= n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

int main(){
	IOS
 	
 	int n,k;
 	cin>>n>>k;
 	vi v(n);
 	cin>>v;

 	vi dp(n+1,INT_MAX);

 	dp[0]=dp[1]=0;
 	dp[2]=abs(v[1]-v[0]);

 	for(int i=3;i<=n;i++)
 	{
 		for(int j=1;j<=k&&(i-j)>0;j++)
 		dp[i] = min(dp[i-j]+abs(v[i-1]-v[i-1-j]),dp[i]);
 	}

 	cout<<dp[n];
 
	return 0;	
}

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

int main(){
  int N;
  cin>>N;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin>>H.at(i);
  }

  bool flag = true;
  for(int i=N-1;i>0;i--){
    if(H.at(i) < H.at(i-1)){
      if(H.at(i-1)-1 == H.at(i)){
        H.at(i-1) -= 1;
      }else{
        cout<<"No"<<endl;
        flag = false;
        break;
      }
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
  }
}


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

int main(void){
    int A,B,C;
    int X;
    cin >> A >> B >> C >> X;
    if(A<0 || B<0 || C<0 || X<50){
        // printf("value error\r\n");
        return 0;
    }
    if(A>50 || B>50 || C>50 || X > 20000){
        // printf("value error\r\n");
        return 0;
    }
    if(X % 50 != 0){
        // printf("value error\r\n");
        return 0;
    }

    int total = 0;
    int counter = 0;
    for (int i = 0; i <= A; i++){
        for (int j = 0; j <= B; j++){
                total = X - 500 * i - 100 * j;
                if (total >= 0 && total % 50 == 0 && total / 50 <= C){
                    // printf("500 = %d, 100 = %d, 50 = %d\r\n",i,j,total/50);
                    counter++;
                } 
        }
    }
    // printf("counter = %d\r\n",counter);
    cout << counter << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int pas,n,ans,x;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		if(pas==x)ans++,pas=0;
		else pas=x;
	}
	printf("%d",ans);
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

struct Item {
    int a, b;
};

int dp1[3000 + 10][3000 + 10];
int dp2[3000 + 10][3000 + 10];

int main() {
    int N, T;
    cin >> N >> T;
    vector<Item> items(N);
    rep(i, N) {
        cin >> items[i].a >> items[i].b;
    }

    dp1[0][0] = 0;
    rep(i, N) {
        rep(j, T) {
            dp1[i + 1][j] = dp1[i][j];
            if (j - items[i].a >= 0) chmax(dp1[i + 1][j], dp1[i][j - items[i].a] + items[i].b);
        }
    }

    dp2[N][0] = 0;
    for (int i = N; i >= 1; i--) {
        rep(j, T) {
            dp2[i - 1][j] = dp2[i][j];
            if (j - items[i - 1].a >= 0) chmax(dp2[i - 1][j], dp2[i][j - items[i - 1].a] + items[i - 1].b);
        }
    }

    int ans = 0;
    rep(i, N) {
        rep(j, T) {
            ans = max(ans, dp1[i][j] + items[i].b + dp2[i + 1][T - 1 - j]);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 70912
N, Q = list(map(int, input().split()))
s = input()
td = [input().split() for i in range(Q)]

td.reverse()

nl = 0
nr = N - 1
L = []
R = []
for i in td:
  if i[1] == "L":
    if nl < N:
      if s[nl] == i[0]:
        L.append(i[0])
        nl += 1
    if len(R) != 0:
      if R[-1] == i[0]:
        R.pop()
        nr += 1
  else:
    if nr >= 0:
      if s[nr] == i[0]:
        R.append(i[0])
        nr -= 1
    if len(L) != 0:
      if L[-1] == i[0]:
        L.pop()
        nl -= 1

print(N - len(L) - len(R))

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

int main() {
  int Ans=0;
  int L; cin >>L;
  int R; cin >>R;
  int d; cin >>d;
  for (int i = L; i <=R; i++) {
    if (i%d==0) Ans++;
  }
  cout << Ans << '\n';
  return 0;
}


Measured memory_bytes: 3592
#[allow(unused_imports)]
use std::cmp::{max, min};

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    // from kenkoooooo
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn usize_read(&mut self) -> usize {
        self.read()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}

fn main() {
    let mut sc = Scanner::new();
    let n: i64 = sc.read();
    for i in 0..100 {
        for j in 0..100 {
            let m = i * 4 + j * 7;
            if m == n {
                println!("Yes");
                return;
            }
        }
    }
    println!("No");
}


Measured memory_bytes: 4352
#include <stdio.h>
 
int egara(char c){
  if(c=='S')return 0;
  if(c=='H')return 1;
  if(c=='C')return 2;
  if(c=='D')return 3;
  return 0;
}
char Egara(int n){
  if(n==0)return 'S';
  if(n==1)return 'H';
  if(n==2)return 'C';
  if(n==3)return 'D';
  return 'S';
}
int main(){
  int n,a[4][13],i,j,m;
  char c,d;
  for(i=0; i<4; i++){
    for(j=0; j<13; j++){
      a[i][j]=1;
    }
  }
  scanf("%d\n",&n);
  for(i=0; i<n; i++){
    scanf("%c %d\n",&c,&m);
    a[egara(c)][m-1]=0;
  }
for(i=0; i<4; i++){
    for(j=0;j<13; j++){
      if(a[i][j])
      printf("%c %d\n",Egara(i),j+1);
    }
  }
  return 0;
}



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

int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s == "abc") {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

bitset<25800> dp[81][81];

int n, m, a[81][81], b[81][81];

int main(){

    cin >> n >> m;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            cin >> a[i][j];
        }
    }
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            cin >> b[i][j];
        }
    }
    dp[1][1][a[1][1]-b[1][1]+12800] = 1;
    dp[1][1][b[1][1]-a[1][1]+12800] = 1;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            if (i-1 >= 1){
                dp[i][j] |= (dp[i-1][j]<<a[i][j]>>b[i][j]);
                dp[i][j] |= (dp[i-1][j]>>a[i][j]<<b[i][j]);
            }
            if (j-1 >= 1){
                dp[i][j] |= (dp[i][j-1]<<a[i][j]>>b[i][j]);
                dp[i][j] |= (dp[i][j-1]>>a[i][j]<<b[i][j]);
            }
        }
    }
    int ans = 1e9;
    for (int i = 0; i < 25800; i++){
        if (dp[n][m][i])
            ans = min(ans, abs(i-12800));
    }
    cout << ans;

}

Measured memory_bytes: 20736
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
const int INF = 1<<28;
const ll MOD = 1000000007;

int main() {
	string s;
	while(getline(cin, s)) {
		string s2 = "";
		REP(i, s.size())
			if(isalpha(s[i]))
				s2.pb(toupper(s[i]));
		vector<string> vs;
		set<string> se;
		REP(i, s2.size()) {
			int cnt = 0;
			FOR(j, 1, s2.size()) {
				if(i-j < 0 || s2.size() < i+j)
					break;
				if(s2[i-j] == s2[i+j]) {
					cnt = j;
					if(cnt > 1)
						se.insert(s2.substr(i-j+1, j*2-1));
				}
				else
					break;
			}
			string s3 = s2.substr(i-cnt, cnt*2 + 1);
			if(cnt > 0  && !se.count(s3))
				vs.pb(s3);
			//2
			if(i != s2.size()-1 && s2[i] == s2[i+1]) {
				int cnt = 0;
				FOR(j, 1, s2.size()) {
					if(i-j < 0 || s2.size() < i+1+j)
						break;
					if(s2[i-j] == s2[i+1+j]) {
						cnt = j;
						if(cnt > 1)
							se.insert(s2.substr(i-j+1, j*2));
					}
					else
						break;
				}
				string s3 = s2.substr(i-cnt, cnt*2 + 2);
				if(cnt > 0  && !se.count(s3))
					vs.pb(s3);
			}
		}
		REP(i, vs.size()) {
			if(!se.count(vs[i])) {
				cout << vs[i];
				if(i != vs.size()-1)
					cout << ' ';
				se.insert(vs[i]);
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;




int main() {

	int n;
	
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n);

	for(int i = 0; i<n; i++){
		cin >> a[i];
	}

	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}

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

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

	vector<long long> sumB(n + 1);

	for (int i = 0; i < n; i++) {
		int cnt;
		if (b[i] <=a[0]) {
			cnt = 0;
		}
		else if (b[i] > a[n - 1]) {
			cnt = n;
		}
		else {
			int r = 0;
			int l = n - 1;
			int mid = (r + l) / 2;

			while (r < mid) {
				if (b[i] > a[mid]) {
					r = mid;
				}
				else {
					l = mid;
				}
				mid = (r + l) / 2;
			}

			cnt = mid + 1;

		}

		
		sumB[i+1] = sumB[i] + cnt;
		
		
	}

	long long ans = 0;
	for (int i = 0; i < n; i++) {
		int pos;
		if (c[i] <= b[0]) {
			pos = 0;
		}
		else if (c[i] > b[n - 1]) {
			pos = n;
		}
		else {
			int r = 0;
			int l = n - 1;
			int mid = (r + l) / 2;

			while (r < mid) {
				if (c[i] > b[mid]) {
					r = mid;
				}
				else {
					l = mid;
				}
				mid = (r + l) / 2;
			}

			pos = mid + 1;

		}
		
		ans += sumB[pos];
	}
	cout << ans << endl;
}

Measured memory_bytes: 2176
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    A = zip(range(1, N+1), A)
    A = sorted(A, key=lambda x: x[1])
    A = [str(a[0]) for a in A]
    S = ' '.join(A)
    print(S)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 31944
import           Control.Monad
main = do
    [w, h, n] <- map read . words <$> getLine
    v <- map (map read . words) <$> replicateM n getLine :: IO [[Int]]
    let m = [0, w, 0, h]
    print . g $ foldr f m v
  where
    f [x, y, a] [w1, w2, h1, h2] =
        case a of
            1 -> [max w1 x, w2, h1, h2]
            2 -> [w1, min w2 x, h1, h2]
            3 -> [w1, w2, max h1 y, h2]
            4 -> [w1, w2, h1, min h2 y]
    g [w1, w2, h1, h2] = max 0 (w2 - w1) * max 0 (h2 - h1)

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
typedef long long int lint;
typedef long double ldouble;

typedef pair<lint, int> E; 
int n;

int main(int, char**) {
    std::ios::sync_with_stdio(false);
    cin >> n;

    lint res = 0;
    lint s = 0;
    unordered_map<lint, lint> m;
    m[0] = 1;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        s += x;
        if (m.count(s)) {
            res += m[s];
        }
        
        m[s] += 1;
    }
    cout << res << endl;

    return 0;
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

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

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U>
void chmax(T &a, U b) {
  if (a < b) a = b;
}

template <class T, class U>
void chmin(T &a, U b) {
  if (b < a) a = b;
}

template <class T>
T Sq(const T &t) {
  return t * t;
}

signed main() {
  vi a;
  REP(i, 3) { a.PB(read()); }
  sort(ALL(a));
  print(a[1] - a[0] + a[2] - a[1]);
}


Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define INF 100000000
typedef long long ll;

int main(void) {
    int n, s;
    while (1) {
        cin >> n >> s;
        if (n == 0 && s == 0) break;
        int ans = 0;
        for (int i = 0; i < (1 << 10); i++) {
            int num = 0, sum = 0;
            for (int j = 0; j <= 9; j++) {
                if ((i >> j) % 2 == 1) {
                    num++;
                    sum += j;
                }
            }
            if (num == n && sum == s) ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

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

int gcd(int a,int b) {
  if (a > b) {
    swap(a,b);
  }
  if (b % a == 0) {
    return a;
  }
  else {
    return gcd(a,b%a);
  }
}

int main() {
  long long N;
  long long ans = 0;
  string S;
  cin >> N >> S;
  long long R = 0;
  long long G = 0;
  long long B = 0;
  for (int i=0; i<N; i++) {
    if (S[i] == 'R') {
      R++;
    }
    else if (S[i] == 'G') {
      G++;
    }
    else {
      B++;
    }
  }
  ans = R*G*B;
  for (int i=0; i<N-2; i++) {
    for (int j=1; j<4000; j++) {
      if (i+j*2 >= N) {
        break;
      }
      if (S[i] != S[i+j] && S[i] != S[i+j*2] && S[i+j*2] != S[i+j]) {
        ans--;
      }
    }
  }
  cout << ans << endl;

}

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

const int maxn = 100000 + 5;

int n, dp[maxn];

int main() {
    while (scanf("%d",&n) == 1) {
        for (int i = 1; i <= n; ++i) dp[i] = INT_MAX;
        dp[0] = 0;
        for (int i = 0; i < n; ++i) {
            if (dp[i] == INT_MAX) continue;
            dp[i + 1] = min(dp[i + 1], dp[i] + 1);
            int d2 = 6, d3 = 9;
            for (; i + d2 <= n;) {
                dp[i + d2] = min(dp[i + d2], dp[i] + 1);
                d2 *= 6;
                if (i + d3 <= n) {
                    dp[i + d3] = min(dp[i + d3], dp[i] + 1);
                    d3 *= 9;
                }
            }
        }
        printf("%d\n", dp[n]);
    }
    return 0;
}


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

int main(void){
    long long a,b;
    int k;
    cin >> a >> b >> k;
    for(int i = 0;i < k;i++){
        if(i % 2 == 0){
            if(a % 2 == 1)a--;
            b += a / 2;
            a /= 2;
        } else {
            if(b % 2 == 1)b--;
            a += b / 2;
            b /= 2;
        }
    }
    cout << a << " " << b << endl;
}

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

using namespace std; 
int c[4];
int main(){ 
  int w,a,b;
  cin>>w>>a>>b;
  if(a>b) {
    swap(a, b);
  }
  if(b-a-w<0) cout<<0;
  else cout<<b-a-w;
}
 

Measured memory_bytes: 256
##C
l,r=map(int,input().split())
c=(r-l)
d=2018
if c>=2018:
    print(0)
else:
    for i in range(l,r):
        for k in range(l+1,r+1):
            
            if (i*k)%2019<d:
                d=(i*k)%2019
    print(d)

Measured memory_bytes: 3060
# coding: utf-8
# coding: Shift_JIS
# coding: EUC-JP
# coding: cp932
import math

n = int(input())
a = input().split()
str = ""
while(n>0):
    n = n-1
    if(n >= 1):
        str = str + a[n] + " "
    else:
        str = str + a[n]

print(str)


Measured memory_bytes: 5656
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int

struct edge
{
  int to, cost;
};
typedef std::vector<std::vector<edge>> graph;
const ll MOD = 1000000007;
using namespace std;

int main()
{
  int n;
  cin >> n;
  ll a[10000];
  REP(i, n)
  {
    cin >> a[i];
  }

  ll mi = MOD, ma = -MOD;
  ll sum = 0;
  REP(i, n)
  {
    mi = min(mi, a[i]);
    ma = max(ma, a[i]);
    sum += a[i];
  }

  cout << mi << " " << ma << " " << sum << endl;
}



Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <unordered_map>
using namespace std;

int main() {
  int s;
  cin >> s;
  unordered_map<int, int> m;
  m[s] = 1;
  int prev = s;
  for (int i = 2; i < 10000000; i++) {
    int next = prev % 2 == 0 ? prev / 2 : 3 * prev + 1;
    if (m.find(next) == m.end()) {
      prev = next;
      m[prev] = i;
    } else {
      cout << i << endl;
      return 0;
    }
  }
}


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

using namespace std;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b){
        cout<<c<<endl;
    }else if(a==c){
        cout<<b<<endl;
    }else{
        cout<<a<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
a=str(input())
if a=="SUN":
    print(7)
elif a=="MON":
    print(6)     
elif a=="TUE":
    print(5)
elif a=="WED":
    print(4)
elif a=="THU":
    print(3)
elif a=="FRI":
    print(2)
else :
    print(1)
    


Measured memory_bytes: 9108
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int a,b,c; cin >> a >> b >> c;
  COUT(c <= (a+b) ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int M,N,i,j,c=0,d=0,s;
    scanf("%d%d",&M,&N);
    int a[M],b[N];
    for(i=0;i<M;i++)
    {
        a[i]=1;
    }
    for(i=0;i<N;i++)
    {
        b[i]=1;
    }
    for(i=0;i<M;i++)
    {
        for(j=i+1;j<M;j++)
        {
            if(a[i]+a[j]==2)
            {
                c++;
            }
        }
    }

    for(i=0;i<N;i++)
    {
        for(j=i+1;j<N;j++)
        {
            if(b[i]+b[j]==2)
            {
                d++;
            }
        }
    }
    s=c+d;
    printf("%d\n",s);
}


Measured memory_bytes: 2124
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

typedef pair<int, int> P;
const int INF = 1000000000;

struct edge {
    int to, cost;
};

int main() {
    int n;
    cin >> n;
    vector<edge> G[n];
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c;
            cin >> v >> c;
            edge e = {v, c};
            G[u].push_back(e);
        }
    }
    vector<int> d(n, INF);
    d[0] = 0;
    priority_queue< P, vector<P>, greater<P> > que;
    que.push(P(0, 0));

    while (!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }

    for (int i = 0; i < n; i++) {
        cout << i << " " << d[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3132
#include<stdio.h>

int main(void){
    int i,A,B,K;
    scanf("%d%d%d",&A,&B,&K);
    for(i = 1;i <= K;i++){
        // printf("%d\n",i);
        if(i % 2 == 1){// takahashi
            if(A % 2 == 1){
                A--;
            }
            
            B += A/2;
            A -= A/2;   
        }

        if(i % 2 == 0){// aoki
            if(B % 2 == 1){
                B--;
            }
            A += B/2;
            B -= B/2;
        }
    }
    printf("%d %d",A,B);
    return 0;

}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>
#include <atcoder/all>

using namespace std;
using namespace atcoder;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define chmax(x,y) x = max(x,y)
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, m, a, b;

int main() {
	cin >> n >> m;
	dsu d(n);
	rep(i, m) {
		cin >> a >> b;
		d.merge(a - 1, b - 1);
	}
	cout << sz(d.groups()) - 1 << endl;
	return 0;
}

Measured memory_bytes: 9028
import sys
input = sys.stdin.readline

N, K = [int(_) for _ in input().split()]

A = [int(_) for _ in input().split()]
MOD = 10**9 + 7

Apos = sorted([el for el in A if el > 0], reverse=True)
Aneg = sorted([el for el in A if el <= 0])

Cpos = 0
Cneg = 0

answer = 1

# edge case to minimize negative
if K % 2 and len(Apos) == 0:
    Aneg = Aneg[::-1]
    for i in range(K):
        answer *= Aneg[i]
        answer %= MOD
else:
    while K > 0:
        if K % 2:
            if Cpos < len(Apos):
                answer *= Apos[Cpos]
                Cpos += 1
            else:
                answer *= Aneg[Cneg]
                Cneg += 1
            answer %= MOD
            K -= 1
        else:
            if Cpos + 1 >= len(Apos) and Cneg + 1 >= len(Aneg):
                answer *= Apos[Cpos] * Aneg[Cneg]
                Cpos += 1
                Cneg += 1
            elif Cpos + 1 >= len(Apos):
                answer *= Aneg[Cneg] * Aneg[Cneg + 1]
                Cneg += 2
            elif Cneg + 1 >= len(Aneg):
                answer *= Apos[Cpos] * Apos[Cpos + 1]
                Cpos += 2
            else:
                if Apos[Cpos] * Apos[Cpos+1] > Aneg[Cneg] * Aneg[Cneg+1]:
                    answer *= Apos[Cpos] * Apos[Cpos + 1]
                    Cpos += 2
                else:
                    answer *= Aneg[Cneg] * Aneg[Cneg + 1]
                    Cneg += 2
            K -= 2
            answer %= MOD
print(answer)


Measured memory_bytes: 105688
import numpy as np
def main():
    H, W, M = map(int, input().split())
    row = np.zeros(W)
    col = np.zeros(H)
    memo = []
    for _ in range(M):
        h, w = map(int, input().split())
        h -=1
        w -=1
        row[w] += 1
        col[h] += 1
        memo.append((h, w))

    col_max = col.max()
    row_max = row.max()

    max_col_indexs = np.where(col == col_max)[0]
    max_row_indexs = np.where(row == row_max)[0]

    ans = col_max + row_max -1
    memo = set(memo)
    for c in max_col_indexs:
        for r in max_row_indexs:
            if (c, r) not in memo:
                ans = ans = col_max + row_max
                print(int(ans))
                exit()

    print(int(ans))

if __name__ == "__main__":
    main()

Measured memory_bytes: 89108
#include <stdio.h>

int getGCD(int a,int b){
	//??????????????????????????????
	int i,temp,r;
	
	if(a < b){
		temp = a;
		a = b;
		b = temp;
	}
	r = a % b; 	
	while(r!=0){
    	a = b;
    	b = r;
    	r = a % b;
	}
	
	return b;
}

long getLCM(int a,int b){
	//LCM = a * b / GCD
	long lcm;
	int gcd = getGCD(a, b);
	lcm = ((long)a * b) / gcd;
		
	return lcm;
}

int main(void){
    int a,b;
	
	while(scanf("%d %d", &a, &b) != EOF){	
        printf("%d %lu\n", getGCD(a, b), getLCM(a, b));
    }
	
	return 0;
}

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

int main() {
  int k, a, b;
  cin >> k >> a >> b;
  if (a <= b/k*k) cout << "OK" << endl;
  else cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long 
#define f(i,n) for(int i=0;i<n;i++) 
#define fr(i,a,b) for(int i=a;i<b;i++) 
#define F first 
#define S second 
#define pb push_back 
#define mp make_pair 
#define P(a,b) pair<a,b> 
#define M(a,b) map<a,b> 
#define V(i) vector<i> 

using namespace std;


void test(){
	int n,m;
	cin>>n>>m;
	if(n==m)cout<<"Yes\n";
	else cout<<"No\n";	
}

int main(){
	int t=1;
//	cin>>t;
	while(t-->0){
		test();
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <limits>
#include <set>
#define MAX 100000
#define rep(i,s,N) for(int i=s;i<N;i++)
using namespace std;
typedef long long int lli;

int main(void)
{
	int N; cin >> N;
	int D, X; cin >> D >> X;
	int sum = 0;
	rep(i, 0, N) {
		int tmp; cin >> tmp;
		sum += ((D - 1) / tmp + 1);
	}
	sum += X;
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256