akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define pb push_back
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

const ll mod = 1000000007;

ll sub(ll a, ll b) {
    ll ans = (a%mod - b%mod + mod)%mod;
    return ans;
}

ll power(ll a, ll n) {
    if(n == 0) return 1;
    else if(n%2 == 0) {
        return power((a%mod*a%mod)%mod, n/2)%mod;
    }
    else return (a%mod * power((a%mod * a%mod), (n-1)/2)%mod)%mod;
}

ll divi(ll a, ll b) {
    ll inv = power(b, mod-2LL);
    ll ans = (a%mod * inv%mod)%mod;
    return ans;
}

ll findProductSum(ll A[], ll n)
{
    // calculating array sum (a1 + a2  ... + an)
    ll array_sum = 0;
    for (ll i = 0; i < n; i++)
        array_sum = (array_sum%mod + A[i]%mod)%mod;

    // calcualting square of array sum
    // (a1 + a2 + ... + an)^2
    ll array_sum_square = (array_sum%mod * array_sum%mod)%mod;

    // calcualting a1^2 + a2^2 + ... + an^2
    ll individual_square_sum = 0;
    for (ll i = 0; i < n; i++) {
        individual_square_sum += (A[i]%mod*A[i]%mod)%mod;
        individual_square_sum %= mod;
    }

    // required sum is (array_sum_square -
    // individual_square_sum) / 2
    ll ret = sub(array_sum_square, individual_square_sum);
    ret = divi(ret, 2LL);
    return ret;
}

void solve() {
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i<n; i++) cin >> a[i];
    ll ans = findProductSum(a, n);
    cout << ans << '\n';
}

int main() {_
    int t = 1;
//    cin >> t;
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 5172
S = input()
a = int(S[0:2])
b = int(S[2:4])

if a > 12 and 0 < b <= 12 or a == 0 and 0 < b <= 12:
  print('YYMM')
elif a > 12 and b > 12:
  print('NA')
elif a > 12 and b == 0 or a == 0 and b > 12:
  print('NA')
elif 0 < a <= 12 and 0 < b <= 12:
  print('AMBIGUOUS')
elif b > 12 and 0 < a <= 12 or b == 0 and 0 < a <= 12:
  print('MMYY')
else:
  print('NA')

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

int main() {  
long long h,w;
  cin>>h>>w;
  if(h==1||w==1){
    cout<<1<<endl;
  }
  else if (h%2==0){
    cout<<(h/2)*w<<endl;
  }
  else if (w%2==0){
    cout<<(w/2)*h<<endl;
  }
  
  else{
    cout<<((h+1)/2)*w-((w-1)/2)<<endl;
  }


}


Measured memory_bytes: 256
def main():
  import sys
  n,s,_,*t=sys.stdin.buffer.read().split()
  n=int(n)
  d=[0]*n+[1<<c-97for c in s]
  for i in range(n-1,0,-1):d[i]=d[i+i]|d[i-~i]
  r=[]
  for q,a,b in zip(*[iter(t)]*3):
    i,s=int(a)+n-1,0
    if q<b'2':
      d[i]=1<<b[0]-97
      while i:
        i//=2
        d[i]=d[i+i]|d[i-~i]
      continue
    j=int(b)+n
    while i<j:
      if i&1:
        s|=d[i]
        i+=1
      if j&1:
        j-=1
        s|=d[j]
      i//=2
      j//=2
    r+=bin(s).count('1'),
  print(' '.join(map(str,r)))
main()

Measured memory_bytes: 45552
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var nw = Input.ar;
        var wv = Input.ar2D(nw[0]);
        var dp = new long[nw[0] + 1, nw[1] + 1];
        for (var i = 1; i <= nw[0]; i++)
            for (var j = 0; j <= nw[1]; j++)
                if (j - wv[i - 1][0] >= 0)
                    dp[i, j] = Max(dp[i - 1, j], dp[i - 1, j - wv[i - 1][0]] + wv[i - 1][1]);
                else
                    dp[i, j] = dp[i - 1, j];
        var res = 0L;
        for (var i = 0; i <= nw[1]; i++)
            res = Max(res, dp[nw[0], i]);
        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

int main()
{
	vector<int> n;
	for(int i = 0; i < 4; i++){
		int ni;
		cin >> ni;
		n.push_back(ni);
	}

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

	if(n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9){
		cout << "YES\n";
	}else{
		cout << "NO\n";
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define repeat_from_reverse(i, m, n) for( int i = (n) - 1; (i) >= (m); --(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t t=0; t<v.size(); ++t){cout << " " << #v << "[" << t << "]=" << v[t];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int k, s; cin >> k >> s;
    int ans = 0;
    repeat_from_to(x, 0, k) {
        repeat_from_to(y, 0, k) {
            int z = s - x - y;
            if (z >= 0 && z <= k) {
                ++ans;
            }
        }
    }
    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 < (int)(n); i++)
int saisyo(int a,int b){
  int ans=0;
  while(b!=0){
    int r=a%b;
    a=b;
    b=r;
  }
  return a;
}
int main(){
  long long a,b,c,d,ans=0;
  cin >> a >>b>>c>>d;
  long long e=a-1,f=c*d/saisyo(c,d);
  ans=b-(b/c+b/d)+b/f;
  ans-=e-(e/c+e/d)+e/f;
  cout << ans;
}

Measured memory_bytes: 256
k = gets.chomp.to_i
array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

puts array[k-1]

Measured memory_bytes: 1788
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A&lang=ja
//素因数分解
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}

template< typename T >
std::vector<std::pair<T,T>> prime_factor_decomp(T n) {
    std::vector<std::pair<T,T>> pe_tbl;
    T m = n;
    for (T i = 2; i * i <= n; i++) {
        if (m % i != 0) continue;
        T c = 0;
        while (m % i == 0) c++, m /= i;
        pe_tbl.emplace_back(i,c);
    }
    if (m > 1) {
        pe_tbl.emplace_back(m,1);
    }
    return pe_tbl;
}

int main() {
  ll n; cin>>n;
  auto ret=prime_factor_decomp(n);
  vector<ll> ans;
  for(const auto& p:ret){
    REP(i,p.second){
      ans.emplace_back(p.first);
    }
  }  
  cout<<n<<":";
  for(const auto& a:ans){
    cout<<" "<<a;
  }
  cout<<endl;

  return 0;
}


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

#define ll long long
#define mod 1000000007
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define vll vector<ll>
#define rep(i,j,n) for(int i=j;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1e17
priority_queue<pll,vector<pll>,greater<pll> >pq;
priority_queue<ll,vector<ll>,greater<ll> >pq1;

ll result(ll a, ll b, ll p){
    ll ans=1;
    if(b==(-1))
        b=p-2;
    while(b){
        if(b&1){
            ans=(ans*a)%p;
        }
        a=(a*a)%p;
        b>>=1;
    }
    return ans;
}

int main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, a,b;
    cin >> n >> a>> b;
    if(a+b==0){
        cout<<0;
        return 0;
    }
    ll p=n/(a+b);
    ll g=p*a;
    p=n%(a+b);
    if(p>a)
        g+=a;
    else
        g+=p;
    cout<<g;

    return 0;
        
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}
long comb(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
using namespace std;
/*int main(){
    int n;std::cin >> n;
    int keta=0;
    while(true){
        keta++;
        if(n/10==0)break;
        n=n/10;
    }
    keta=keta-1;
    if(n>=7)n=3;
    else if(n>=5)n=2;
    else if(n>=3)n=1;
    int k=0;
    for(int i=3;i<=keta;i++){
        k+=comb(i-1,2);
        std::cout << k << std::endl;
    }std::cout << k << std::endl;
    k+=n*(keta);
    
    std::cout << k << std::endl;
    
}


*/
int main(){
  int n,b,c;
  std::cin>>n;
  int i=1;
  std::cout << (n%2==0?n:n+n) << std::endl;
}


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

int main(){
  int N;
  scanf("%d", &N);
  std::string S, T;
  std::cin >> S;
  std::cin >> T;
  std::string ans;
  //char ans[2*N];
  int cnt = 0;
  for (int i=0; i<N; i++){
    //ans[cnt] = S[i];
    ans += S[i];
    cnt++;
    //ans[cnt] = T[i];
    ans += T[i];
    cnt++;
  }
  //ans[2*N] = '';
  //printf("%s\n",ans);
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF=1001001001;
 
int main() {
  string n;
  cin>>n;
  bool x=false;
  rep(i,3){
  if(n[i]=='7') x=true;
  }
 
 if(x){ cout<<"Yes"<<endl;}
else{
cout<<"No"<<endl;
}
}

Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
vector<int> a[N];
ii range[N], old_range[N];
int ret[N];

bool DFS(int u, int parent) {
  if (parent >= 0) {
    range[u].first = max(range[u].first, range[parent].first - 1);
    range[u].second = min(range[u].second, range[parent].second + 1);
  }
  if (range[u].second < range[u].first) return false;
  for (auto& v : a[u]) {
    if (v == parent) continue;
    if (!DFS(v, u)) return false;
    range[u].first = max(range[u].first, range[v].first - 1);
    range[u].second = min(range[u].second, range[v].second + 1);
    if (range[u].second < range[u].first) return false;
  }
  return true;
}

bool DFS2(int u, int parent, int k) {
  if (parent >= 0) {
    range[u].first = max(range[u].first, ret[parent] - 1);
    range[u].second = min(range[u].second, ret[parent] + 1);
  }
  if ((range[u].first & 1) == k) {
    ret[u] = range[u].first;
  } else {
    if (range[u].first + 1 <= range[u].second) {
      ret[u] = range[u].first + 1;
    } else {
      return false;
    }
  }
  for (auto& v : a[u]) {
    if (v == parent) continue;
    if (!DFS2(v, u, 1 - k)) return false;
  }
  return true;
}

bool check(int n) {
  copy(range, range + n, old_range);
  if (DFS2(0, -1, 0)) return true;
  copy(old_range, old_range + n, range);
  if (DFS2(0, -1, 1)) return true;
  return false;
}

int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x; --y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (int i = 0; i < n; ++i) {
    range[i] = {-INF, INF};
  }
  scanf("%d", &m);
  while (m--) {
    int x, val;
    scanf("%d%d", &x, &val);
    --x;
    range[x] = {val, val};
  }
  bool ans = DFS(0, -1);
  // for (int i = 0; i < n; ++i) {
  //   cout << i + 1 << " " << range[i].first << " " << range[i].second << endl;
  // }
  if (ans) ans = check(n);
  puts(ans ? "Yes" : "No");
  if (ans) {
    for (int i = 0; i < n; ++i) {
      printf("%d\n", ret[i]);
    }
  }
  return 0;
}


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N, M, K;
	cin >> N >> M >> K;

	bool check = false;
	for(int i = 0; i <= N; i++){
		for(int j = 0; j <= M; j++){
			llong res = i*(M-j) + j*(N-i);
			if(res == K)
				check = true;
		}
	}

	if(check)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int llu;
typedef long double ld;
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pair<int,int>>
#define pb push_back
#define pf push_front
#define mp map<ll,ll>
#define INF 1000000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
ll gcd(ll a,ll b)
{
    if(a==0)
    {
        return b;
    }
    else
    {
        return gcd(b%a,a);   
    }
}
ll lcm(ll a,ll b)
{
    return a*b/gcd(a,b);
}
int f(char c)
{
    return (int)c-96;
}
/**********************************************************************
***********************************************************************
*********************ACTUAL CODE BEGINS HERE***************************/
int main()
{   
    fast;
    int d,t,s;
    cin>>d>>t>>s;
    if(t*s>=d)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 3660
#define _USE_MATH_DEFINES
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	int w, a, b;

	cin >> w >> a >> b;

	if (a <= b && b <= a + w) {
		cout << 0 << endl;
		return 0;
	}
	
	if (a <= b + w && b + w <= a + w) {
		cout << 0 << endl;
		return 0;
	}

	if (abs(b - (a + w)) < abs(a - (b + w))) {
		cout << b - (a + w) << endl;
	}
	else {
		cout << a - (b + w) << endl;

	}



}

Measured memory_bytes: 256
t1,t2=map(int,input().split())
a1,a2=map(int,input().split())
b1,b2=map(int,input().split())
x=(a1-b1)*t1
y=(a2-b2)*t2
if x>0:
  x*=-1
  y*=-1
if x+y<0:print(0)
elif x+y==0:print("infinity")
else:
  ans=(-x)//(x+y)
  if (-x)%(x+y):print(ans*2+1)
  else:print(ans*2)

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func factorial(x int)int{
	total := 1
	for i:=1;i<=x;i++{
		total = total*i%1000000007
	}
	return total
}

func main(){
	var dog,monkey int
	fmt.Scan(&dog,&monkey)
	if dog-monkey > 1 || monkey-dog > 1{
		fmt.Println("0")
	}else if dog == monkey{
		n := factorial(dog)
		fmt.Println(n*n*2%1000000007)
	}else{
		fmt.Println(factorial(dog)*factorial(monkey)%1000000007)
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h> 
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define per(i,n) for(long long i = (long long)(n-1);i >= 0;--i)
#define REP(i,s,t) for(long long i=s;i<t;i++)
#define PER(i,s,t) for(long long i=s;i>t;--i)
#define all(x) x.begin(),x.end()
#define sp(n) setprecision(n)
typedef long long ll;
using namespace std;
ll p=1000000007;
vector<ll> e(60,0),q(60);
ll f(int k){
  q[0]=k;
  REP(i,1,60){
    q[i]=(q[i-1]*q[i-1])%p;}
  ll prime=p-2;
  rep(i,60){
      if(prime%2==1){
          e[i]=1;
      }
      prime/=2;
  }
  ll t=1;
  rep(i,60){if(e[i]==1){t=(t*q[i])%p;}}
  return t;}
int main(){
    int x,y;
  cin>>x>>y;
  if(-x+2*y>=0&&(-x+2*y)%3==0&&2*x-y>=0&&(2*x-y)%3==0){
    int a=(-x+2*y)/3,b=(2*x-y)/3;
    ll v=1,w=1,z=1;
    for(int i=1;i<=a+b;i++){v=v*i%p;}
    for(int i=1;i<=a;i++){w=w*i%p;}
    for(int i=1;i<=b;i++){z=z*i%p;}
    ll s=((v*f(w)%p)*f(z))%p;
    cout<<s<<endl;}
  else cout<<0<<endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]

includes = False
for r in range(N - M + 1):
    for c in range(N - M + 1):
        for i in range(M):
            for j in range(M):
                if A[r + i][c + j] != B[i][j]:
                    break
            else:
                continue
            break
        else:
            includes = True

print('Yes' if includes else 'No')


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(i, v) for(auto i =  v.begin(); i !=  v.end(); ++i)
#define RFOR(i, v) for(auto i = v.rbegin(); i != v.rend(); ++i)

template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T> ostream & operator<<(ostream & os, const vector<T> & v) {
	os << "[";
	FOR(it, v) {
		if(it != v.begin()) { os << ", "; }
		os << *it;
	}
	os << "]";
	return os;
}
template<typename F, typename S> ostream & operator<<(ostream & os, const pair<F, S> & p) {
	os << "<" << p.FI << ", " << p.SE << ">";
	return os;
}

// ---- ----

LL x, y, ans;

int main() {
	cin >> x >> y;
	if(x >= 0) {
		if(x <= y) { ans = y - x; }
		else if(y <= -x) { ans = -y - x + 1; }
		else if(y <= 0) { ans = y + x + 1; }
		else { ans = x - y + 2; }
	} else {
		if(-x <= y) { ans = y + x + 1; }
		else if(y < x) { ans = x - y + 2; }
		else if(y <= 0) { ans = y - x; }
		else { ans = -y - x + 1; }
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
/*...
  ...
  author 
  @
  Aman Kothari
  .....
  .....*/
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    double d;
    cin>>n>>d;
    double x,y;
    ll count=0;
    double sq=0,rt=0;
    for(ll i=1;i<=n;i++){
    	cin>>x;
    	cin>>y;
    	sq=(x*x)+(y*y);
    	rt=sqrt(sq);
    	if(rt<=d){
    		count++;
    	}
    }
    cout<<count<<"\n";
    return 0;
}

Measured memory_bytes: 3860
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int half, ans = 0;
  string str;

  while(cin >> str) {
    int n = str.length();
    half = n/2 + n%2;

    bool b = true;
    for(int i = 0, j = n-1; i < half; i++, j--) {
      if(str[i] != str[j]) {
	b = false;
	break;
      }
    }
    if(b)ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n,m; cin>>n>>m;
    int cnt[n]={};
    while(m--){
        int a,b; cin>>a>>b;
        cnt[--a]++;
        cnt[--b]++;
    }
    rep(i,n){
        if(cnt[i]%2){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}


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

int main(){
  string s;
  cin>>s;
  string origin ="qazwsxedcrfvtgbyhnujmiklop";
  int size = origin.size();
  for(int i=0;i<size;i++){
    int count=0;
    for(int j=0;j<s.size();j++){
      if(origin.at(i)==s.at(j)){
        count++;
      }
    }
    if(1<count){
      cout<<"no"<<endl;
      return 0;
    }
  }
  cout<<"yes"<<endl;
}

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

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '?')
            s[i] = 'D';
    }

    cout << s << endl;


    return 0;
}


Measured memory_bytes: 3748
use std::collections::VecDeque;
use std::collections::HashMap;

fn main(){
  let dv: Vec<i32> = vec![-4, 1, 4, -1];
  
  let mut que: VecDeque<(Vec<u32>, i32, u32)> = VecDeque::new();
  let mut mp: HashMap<u32, u32> = HashMap::new();

  let v0: Vec<u32> = vec![0, 1, 2, 3, 4, 5, 6, 7];
  
  mp.insert(hash(&v0), 0);
  que.push_back((v0, 0, 0));
    
  loop {
    match que.pop_front() {
      Some((v, i, c)) => {
        for d in &dv {
          let ni = i + d;
            
          if ni >= 0 && ni <= 7 &&
             (i != 3 || ni != 4) &&
             (i != 4 || ni != 3) {
            let mut nv: Vec<u32> = v.clone();
            nv[i as usize] = v[ni as usize];
            nv[ni as usize] = v[i as usize];
            let nh = hash(&nv);
            
            if !mp.contains_key(&nh) {
              mp.insert(nh, c + 1);
              que.push_back((nv, ni, c + 1));
            }
          }
        }
      },
      None => { break; }
    }
  }
  
  loop {
    let mut buf = String::new();
    
    if let Ok(c) = std::io::stdin().read_line(&mut buf) {
      if c < 15 { break; }
    }

    let v: Vec<u32> = buf.split_whitespace().map(|e| e.parse().unwrap()).collect();
    let h: u32 = hash(&v);
    println!("{}", mp.get(&h).unwrap());
  }
}

fn hash(v: &Vec<u32>) -> u32{
  v.iter().fold(0, |s, a| s * 10 + a)
}



Measured memory_bytes: 5048
#include<iostream>
#include<vector>
#include<cstdio>
#include<algorithm>
#include<string>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

int w,n;
vector<int> v;
vector<int> g;

void init(){
	v.clear();
	g.clear();
}
bool input(){
	cin>>w;
	if(w==0)return false;
	cin>>n;
	
	rep(i,n){
		int a,b;
		scanf("%d,%d",&a,&b);
		v.push_back(a);
		g.push_back(b);
	}
	return true;
}

const int W = 1111;
const int N = 1111;
const int INF = 1000000000;
int dp[N][W];

pair<int,int> solve(){
	rep(i,N)rep(j,W)dp[i][j]=0;
	
	reps(i,g[0],w+1)dp[0][i]=v[0];
	
	reps(i,1,n){
		rep(j,w+1){
			if(j!=0)dp[i][j] = dp[i-1][j];
			dp[i][j] = max(dp[i][j],dp[i-1][j]);
			if(j-g[i]>=0)dp[i][j] = max(dp[i][j], dp[i-1][j-g[i]]+v[i]);
		}
	}
	
	int maxp = 0;
	rep(j,w+1){
		if(dp[n-1][maxp]<dp[n-1][j])maxp=j;
	}
	
	/*
	rep(i,n){
		rep(j,w+1)printf("%3d ",dp[i][j]);puts("");
	}*/
	
	return pair<int,int>(dp[n-1][maxp],maxp);
}
int main(){
	for(int i=1;init(),input();i++){
		pair<int,int> ans = solve();
		printf("Case %d:\n%d\n%d\n",i,ans.first,ans.second);
	}
}

/*
10
5
60,2
100,4
120,6
210,9
10,1
0


10
2
100,5
90,4
0

*/

Measured memory_bytes: 6080
#include <bits/stdc++.h>
#define lint long long
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
using namespace std;

// cout << fixed << setprecision(12)

int main(){
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  
  int bedtime = 60 * h2 + m2;
  int start = bedtime - k;
  int wakeup = 60 * h1 + m1;
  cout << start - wakeup << endl;
}
  
  

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

ll _gcd(ll a, ll b) {
    if (a == 0)return b;
    return _gcd(b % a, a);
}
ll _lcm(ll a, ll b) { return a / _gcd(a, b) * b; }

int main() {
    init();

    int n; cin >> n;
    VI p(n); cin >> p;
    int ans = 0;
    FOR(bit, 1, 1 << n) {
        ll m = 1;
        bool ok = true;
        FOR(i, 0, n)if (bit & (1 << i))m = _lcm(m, p[i]);
        FOR(i, 0, n)if (!(bit & (1 << i)) && m % ll(p[i]) == 0) {
            ok = false;
        }
        if (ok)++ans;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long INF = 1LL << 60; 

int main()
{
  ll N; cin >> N;
  ll sum = N*(N+1)/2;
  ll sum3;
  if(N >= 3) sum3 = (3+N/3*3)*(N/3)/2;
  else sum3 = 0;
  ll sum5;
  if(N >= 5) sum5 = (5+N/5*5)*(N/5)/2;
  else sum5 = 0;
  ll sum15;
  if(N >= 15) sum15 = (15+N/15*15)*(N/15)/2;
  else sum15 = 0;
  cout << sum-sum3-sum5+sum15 << endl;
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<stdlib.h>
typedef struct Graph
{
  int key;
  int numOfAdj;
  int *adj;
  int status;//0:not discovered, 1:discovered, 2:finished
} graph;
void depthFirstSearch(void);
void visit(int);
int n;//num of vertice
graph *p;//array of vertice
int *d;//timestamp of first discovered time
int *f;//timestamp of finishing examining time
int timeOfSearch;//time passed during the depth first search
int main(void)
{
  int i,j;//counter
  int key,numOfAdj,adj;
  scanf("%d",&n);
  p=(graph*)malloc(sizeof(graph)*n);
  d=(int*)malloc(sizeof(int)*n);
  f=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&key);
      scanf("%d",&numOfAdj);
      p[key-1].numOfAdj=numOfAdj;
      p[key-1].adj=(int*)malloc(sizeof(int)*numOfAdj);
      for(j=0;j<numOfAdj;j++)
        {
          scanf("%d",&adj);
          p[key-1].adj[j]=adj-1;
        }
      p[key-1].status=0;
      d[i]=0;
      f[i]=0;
    }
  depthFirstSearch();
  return 0;
}
void depthFirstSearch(void)
{
  int i;//counter
  timeOfSearch=0;
  for(;;)
    {
      for(i=0;i<n;i++)
        {
          if(p[i].status==0) visit(i);
        }
      if(i==n) break;
    }
  for(i=0;i<n;i++)
    {
      printf("%d %d %d\n",i+1,d[i],f[i]);
    }
}
void visit(int key)
{
  int i;//counter
  p[key].status=1;
  timeOfSearch++;
  d[key]=timeOfSearch;
  for(i=0;i<p[key].numOfAdj;i++)
    {
      if(p[p[key].adj[i]].status==0) visit(p[key].adj[i]);
    }
  p[key].status=2;
  timeOfSearch++;
  f[key]=timeOfSearch;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N,Y;
    cin>>N>>Y;
    rep(i,N+1)
    {
        rep(j,N-i+1)
        {
            int k = N-i-j;
            if(10000*i+5000*j+1000*k==Y)
            {
                cout<<i<<" "<<j<<" "<<k;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1";
    return 0;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d %d %d", $x, $y, $z, $k);
$A = array_map('intval', explode(' ', trim(fgets(STDIN))));
$B = array_map('intval', explode(' ', trim(fgets(STDIN))));
$C = array_map('intval', explode(' ', trim(fgets(STDIN))));
sort($A);
sort($B);
sort($C);

$ab = [];
for ($i = 0; $i < $x; ++$i) {
    for ($j = 0; $j < $y; ++$j) {
        $ab[] = $A[$i] + $B[$j];
    }
}
rsort($ab);
array_splice($ab, $k);

$abc = [];
for ($i = 0; $i < 3001; ++$i) {
    for ($j = 0; $j < $z; ++$j) {
        $abc[] = $ab[$i] + $C[$j];
    }
}
rsort($abc);
for ($i = 0; $i < $k; ++$i) {
    echo $abc[$i], PHP_EOL;
}


Measured memory_bytes: 137948
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a,b,ans;
struct node
{
	ll l,r;
	node(){}
	node(ll l,ll r):l(l),r(r){}
	friend bool operator < (const node &r1,const node &r2)
	{return r1.l==r2.l ? r1.r<r2.r : r1.l<r2.l;}
};
vector<node>vec;
void solve(ll l,ll r)
{
	vec.push_back(node(l,r));
	if(l>=r)return;
	int p;
	for(p=60;p>=0;p--)
		if((l>>p&1)!=(r>>p&1))break;
	ll r1=0,l2=0;
	for(int i=60;i>p;i--)r1+=l&(1ll<<i),l2+=l&(1ll<<i);
	for(int i=p;i>=0;i--)r1+=1ll<<i;
	l2+=1ll<<p;
	ll l1=l+(1ll<<p);
	vec.push_back(node(l1,r1));
	solve(l2,r);
}
int main()
{
	//freopen("tt.in","r",stdin);
	scanf("%lld%lld",&a,&b);
	solve(a,b);
	sort(vec.begin(),vec.end());
	ll l=vec[0].l,r=vec[0].r;
	for(int i=1;i<vec.size();i++)
	{
		if(vec[i].l>r)
		{
			ans+=r-l+1;
			l=vec[i].l;r=vec[i].r;
		}
		else r=max(r,vec[i].r);
	}
	ans+=r-l+1;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e15+9
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

ll table[2][12] = { { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30 ,31}
, { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30.31 } };

ll solve(ll y, ll m, ll d){
	ll res = 0, year = y;
	y--;
	res += (y / 400) * 146097;
	y %= 400;
	res += (y / 100) * 36524;
	y %= 100;
	res += (y / 4) * 1461;
	y %= 4;
	res += y * 365;
	if (year % 4 == 0){
		if (year % 400 != 0 && year % 100 == 0){
			REP(i, m - 1)res += table[0][i];
		}
		else{
			REP(i, m - 1)res += table[1][i];
		}
	}
	else{
		REP(i, m - 1)res += table[0][i];
	}
	res += d;
	return res;
}

int main(){
	ll a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f){
		if (a < 0 || b < 0 || c < 0 || d < 0 || e < 0 || f < 0)break;
		cout << solve(d, e, f) - solve(a, b, c) << endl;
	}
}

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

using namespace std;

#define int long long
// #define double long double
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()

template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CCIN(...)                                                              \
    char __VA_ARGS__;                                                          \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<bool> VB;
typedef vector<double> VD;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 5e18;
// const double PI = atan(1.0) * 4.0;
const ll dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
#define PI 3.141592653589793238

signed main() {
    SCIN(S);
    if(S == "Sunny") {
        cout << "Cloudy"
             << "\n";
    } else if(S == "Cloudy") {
        cout << "Rainy"
             << "\n";
    } else {
        cout << "Sunny"
             << "\n";
    }
}


Measured memory_bytes: 256
import numpy as np
import sys
import itertools

n = int(input())
s = [0, 0, 0, 0, 0]

for i in range(n):
    t = input()[0:1]
    if t == "M":
        s[0] += 1
    elif t == "A":
        s[1] += 1
    elif t == "R":
        s[2] += 1
    elif t == "C":
        s[3] += 1
    elif t == "H":
        s[4] += 1

k = []
for i in range(len(s)):
    if s[i] > 0:
        k.append(s[i])

l = len(k)
if l < 3:
    print(0)
    sys.exit()

a = 0
c = list(itertools.combinations(range(l), 3))
for i in c:
    a += k[i[0]] * k[i[1]] * k[i[2]]

print(a)


Measured memory_bytes: 19628
/*input
10000 1
*/
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second
#define watch(x) cout << (#x) << " is " << (x) << endl
#define N 100002

using namespace std;
int main()
{
	fastio
	ll T=1,n,m;string str;
	// cin>>T;
	// cin.ignore(); put after cin, just b4 a getline(cin, s) to avoid getline() directly getting \n
	while(T--)
	{
		ll p=0,q=0,tmp=0,sum=0,count=0; //tmp variable
		int flag=0;
		
		cin>>n>>m;
		if(n%m)
			cout << n/m +1<< endl;
		else
			cout << n/m  << endl;
	}
	return 0;
}

Measured memory_bytes: 256
cards = [[False for i in range(13)] for i in range(4)]
pattern = ['S', 'H', 'C', 'D']

N = int(input())
for i in range(N):
    p = input()
    ch,b = p.split()
    num = int(b)
    cards[pattern.index(ch)][num-1] = True

for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            print('{0} {1}'.format(pattern[i], j+1))


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

int main() {
  int a;
  cin >> a;
  int b = a/100;
  int c = (a%100)/10;
  int d = (a%100)%10;
  if (b == d) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

vector<double> x, y;

int main(){
    ll N;
    cin >> N;
    x.resize(N), y.resize(N);
    rep(i, 0, N) cin >> x[i] >> y[i];
    double ans = 0;
    ll a[N];
    rep(i, 0, N) a[i] = i;
    do{
        double d = 0;
        for(ll i = 0; i < N-1; i++){
            double dx = x[a[i]] - x[a[i+1]];
            double dy = y[a[i]] - y[a[i+1]];
            d += sqrt(dx * dx + dy * dy);
        }
        ans += d;
    }while(next_permutation(a, a+N));
    double div = 1;
    rep(i, 2, N+1) div *= i;
    printf("%.12lf\n", ans/div);
    return 0;
}

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

using namespace std;

struct Card {
  int row;
  int col;
  int value;
};

int main() {
  int N, H, W;
  cin >> N >> H >> W;
  vector<int> parent(W + H + 1, -1);
  vector<int> size(W + H + 1, 1);
  vector<bool> saturated(W + H + 1);
  vector<Card> cards;
  for (int i = 1; i <= N; ++i) {
    cards.emplace_back();
    auto&& c = cards.back();
    cin >> c.row >> c.col >> c.value;
    c.col += H;
  }
  auto cmp = [](auto&& lhs, auto&& rhs) {
    return lhs.value > rhs.value;
  };
  sort(cards.begin(), cards.end(), cmp);
  int64_t result = 0;
  for (auto&& card : cards) {
    int row = card.row;; 
    for (; parent[row] != -1; row = parent[row]);
    int col = card.col;; 
    for (; parent[col] != -1; col = parent[col]);
    if (row == col) {
      if (saturated[row]) {
        continue;
      }
      saturated[row] = true;
    } else {
      if (saturated[row] && saturated[col]) {
        continue;
      }
      if (size[row] < size[col]) swap(col, row);
      size[row] += size[col];
      parent[col] = row;
      saturated[row] = saturated[row] || saturated[col];
    }
    result += card.value;
  }
  cout << result << endl;
}


Measured memory_bytes: 3448
N = input()
nums = list(map(int, input().split()))
rests = []
rest_sum = 0
for i in reversed(nums):
    rest_sum += i
    rests.append(rest_sum)

sum_num = 0
for i in range(len(nums)-1):
    sum_num += nums[i]*rests[-(i+2)]
    if sum_num > 10**9 + 7:
        sum_num = sum_num % (10**9 + 7)
    

print(sum_num)

Measured memory_bytes: 31608
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fi first
#define sc second
#define ALL(x) x.begin(), x.end()
#define RALL(X) x.begin(), x.end()
#define FOR(i, n, k) for(i=0; i<n; i+=k)
#define FO(i, n, k) for(i=1; i<=n; i+=k)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define N 100005
#define mid ((l+r)/2)
#define dbg(x) (cerr << #x << " : " << x << endl)
#define endl "\n"

using namespace std;

#define int long long

const int NMAX = 5e3 + 5;

int dp[NMAX][NMAX];
int n, res;

string s;

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

	cin >> n;	
	cin >> s;


	for(int i=n-1; i>=0; i--){
		for(int j=n-1; j>i; j--){
			if(s[i] == s[j]){
				dp[i][j] = max(dp[i][j], 1 + dp[i+1][j+1]);	
			}
			res = max(res, min(dp[i][j], j-i));
		}
	}

	cout << res;

	return 0;
}


/*
ababab

2 7
2 3 4 5 6 7

1 8
1 2 3 4 5 6 7 8
*/

Measured memory_bytes: 194944
n, m = map(int, input().split())
p, s = [], []
pslist = []
for i in range(m):
  row = list(input().split( ))
  pslist.append(row)
aclist = [0] * n
walist = [0] * n
for j, k in pslist:
  j = int(j)
  if k == 'AC':
    if aclist[j - 1] == 0:
      aclist[j - 1] = 1
  if k == 'WA':
    if aclist[j - 1] == 0:
      walist[j - 1] += 1
wacountlist = [x * y for (x, y) in zip(aclist, walist)]
print(sum(aclist), sum(wacountlist))

Measured memory_bytes: 28332
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
#define overload4(_1,_2,_3,_4,name,...) name
#define rep1(n) for(ll i=0;i<(n);++i)
#define rep2(i,n) for(ll i=0;i<(n);++i)
#define rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep4(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vec vector<ll>
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;}

void solve(ll n, ll a, ll b){
    if(abs(a-b)%2==0){
        cout<<abs(a-b)/2<<endl;
    }else{
        ll d=min(a-1+b-1,n-a+n-b);
        cout<<(d+1)/2<<endl;
    }
}

int main(){
    ll n;
    scanf("%lld",&n);
    ll a;
    scanf("%lld",&a);
    ll b;
    scanf("%lld",&b);
    solve(n, a, b);
}


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

vector<ll> AB;
vector<ll> ans;

int main() {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<ll> A(X);
    vector<ll> B(Y);
    vector<ll> C(Z);
    rep(i, X) cin >> A[i];
    rep(i, Y) cin >> B[i];
    rep(i, Z) cin >> C[i];
    sort(all(C));
    reverse(all(C));

    rep(x, X) rep(y, Y) {
        AB.push_back(A[x] + B[y]);
    }
    sort(all(AB));
    reverse(all(AB));

    rep(i, min(X*Y, K)) rep(z, min(K, Z)) {
        ans.push_back(AB[i] + C[z]);
    }
    sort(all(ans));
    reverse(all(ans));

    rep(i, K) cout << ans[i] << endl;
}


Measured memory_bytes: 43112
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

int n;

int solve(int n,int m){
	if(!n)return 1;
	if(n<0)return 0;
	int res=0;
	rep(i,m)res+=solve(n-(i+1)*(i+1),i+1);
	return res;
}

int main(){
	while(cin>>n&&n)cout<<solve(n,17)<<endl;
}

Measured memory_bytes: 0
from itertools import compress, product

s = input()
n = len(s)

indicess = ([0]+list(compress(range(1, n), masks))+[n] for masks in product((0,1), repeat=n-1))
ijss = (zip(indices, indices[1:]) for indices in indicess)
sums = (sum(int(s[i:j]) for i, j in ijs) for ijs in ijss)
print(sum(sums))

Measured memory_bytes: 3064