akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

vector<int> sieve(int n) {
    vector<int> res(n);
    iota(ALL(res), 0);
    for(int i = 2; i * i < n; i++) {
        if(res[i] < i) {
            continue;
        }
        for(int j = i * i; j < n; j += i) {
            if(res[j] == j) {
                res[j] = i;
            }
        }
    }
    return res;
}

vector<int> factor(int n, const vector<int> &min_factor) {
    vector<int> res;
    while(n > 1) {
        res.emplace_back(min_factor[n]);
        n /= min_factor[n];
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    set<ll> se;
    bool ok = true;

    static vector<int> min_factor = sieve(1000100);
    static vector<bool> used(1000100, false);
    for(int i = 0; i < n; i++) {
        auto v = factor(a[i], min_factor);
        sort(ALL(v));
        v.erase(unique(ALL(v)), v.end());
        for(auto j : v) {
            if(used[j]) {
                ok = false;
            }
            used[j] = true;
        }
    }

    if(ok) {
        cout << "pairwise coprime\n";
        return 0;
    }
    ll g = 0;
    for(int i = 0; i < n; i++) {
        g = gcd(g, a[i]);
    }
    if(g == 1) {
        cout << "setwise coprime\n";
    } else {
        cout << "not coprime\n";
    }
}

Measured memory_bytes: 15064
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>

void change(std::vector<int> taro, std::vector<int> hanako) {
    int t_size = taro.size();    
    int h_size = hanako.size();    
    int t_total = 0;
    int h_total = 0;

    for (int i = 0; i < t_size; i++) {
        t_total += taro[i]; 
    }
    for (int i = 0; i < h_size; i++) {
        h_total += hanako[i]; 
    }
    int diff = h_total - t_total;
    if (diff % 2 != 0) {
        std::cout << "-1" << std::endl;
        return;
    }
    diff /= 2;

    int check = 0;

    while (check != t_size) {
        int search_num =  taro[check] + diff;;
        for (int i = 0; i < h_size; i++) {
            if (hanako[i] == search_num) {
                std::cout << taro[check] << " " << hanako[i] << std::endl; 
                return;
            }
        }
        check++;
    }
    std::cout << "-1" << std::endl;
    return;
}

int main(void) {
    int n;
    int m;
    std::cin >> n >> m;
    while (n != 0) {
        std::vector<int> taro(n);
        std::vector<int> hanako(m);
        for (int i = 0; i < n; i++) {
            std::cin >> taro[i];
        }
        for (int j = 0; j < m; j++) {
            std::cin >> hanako[j];
        }
        std::sort(taro.begin(), taro.end() );
        std::sort(hanako.begin(), hanako.end() );
        change(taro, hanako);

        std::cin >> n >> m;
    }
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3152
import sys
s = int(input())
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if s<=2:
    print(0)
    sys.exit()

#ありうる最大の項数
mxlen = s//3
sm = 0
for i in range(mxlen):
    tmps = s - (2*(i+1))
    #(tmp-1)C(i)
    sm += cmb(tmps-1, i)
    if sm >= 10**9+7:
        sm %= 10**9+7



print(sm)

Measured memory_bytes: 9544
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var: ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
    }
    let mut counter = 0;
    for i in 1..n + 1 {
        if i >= 1 && i < 10 {
            counter += 1;
        } else if i >= 100 && i < 1000 {
            counter += 1;
        } else if i >= 10000 && i < 100000 {
            counter += 1;
        }
    }
    println!("{}", counter);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
	class Program3
	{
		static void Main(string[] args)
		{
			var s = Console.ReadLine();

			int ans = 0;
			bool next = true;
			for (int i = 0; i < s.Length; i++)
			{
				bool b = true;
				if (s[i].Equals('0'))
				{
					b = true;
				}
				else
				{
					b = false;
				}

				if (i == 0)
				{
					next = !b;
					continue;
				}

				if (!next.Equals(b))
				{
					ans++;
				}

				next = !next;
			}

			if (ans > s.Length - ans)
			{
				ans = s.Length - ans;
			}
			Console.Write(ans.ToString() + "\n");
			//Console.ReadLine();
		}
	}
}


Measured memory_bytes: 11232
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		ll int n;
		cin>>n;
		ll int a[n+1],b[n+1],c[n+1];
		for(ll int i=1;i<=n;i++) cin>>a[i]>>b[i]>>c[i];
		ll int dp[n][4];
		dp[1][1]=a[1];
		dp[1][2]=b[1];
		dp[1][3]=c[1];
		for(ll int i=2;i<=n;i++)
		{
			dp[i][1]=a[i]+max(dp[i-1][2],dp[i-1][3]);
			dp[i][2]=b[i]+max(dp[i-1][1],dp[i-1][3]);
			dp[i][3]=c[i]+max(dp[i-1][2],dp[i-1][1]);
		}
		cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl



int main(){
    set<char> a;
    string s;
    cin>>s;
    REPARR(i,s){
        if(a.count(s[i])){
            yes(0);
            return 0;
        }else{
            a.insert(s[i]);
        }
    }
    yes(1);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
  ll n,m;
  cin >> n >> m;
  ll res = 0LL;
  if (n == 1 || m == 1){
    if (max(n,m) == 1){
      res = 1;
    }else{
      res = n*m - 2;
    }
  }else{
    res = (n-2)*(m-2);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,i,mx,mi,x;
	long long sum;
	scanf("%d",&n);
	sum=0;
	mx=-10000000;
	mi=10000000;
	for(i=0;i<n;i++)	{
		scanf("%d",&x);
		mx=max(mx,x);
		mi=min(mi,x);
		sum+=x;
	}
	printf("%d %d %lld\n",mi,mx,sum);
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
#define X first;
#define Y second;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
const ll INF = 2e18;
const int inf = 1e9+10;
const int maxN = 3e5 + 10;
const int maxK = 1e4+10;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 998244353;


int a[1010];
int b[1010];

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
	}
	int flag = 0;
	for(int i=1;i+2<=n;i++)
	{
		if(a[i] == b[i] && a[i+1] == b[i+1] && a[i+2] == b[i+2])
		{
			flag = 1;
			puts("Yes");
			break;
		}
	}
	if(!flag)
	{
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 3644
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();
    int T = sc.nextInt();

    double num =  ( T + 0.5 ) / A  ;
    System.out.println((int)num * B);
    }
  }


Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define INF 1000000000000000007
#define pb emplace_back 
#define mx 1e9+2
#define all(s) s.begin(),s.end()
typedef vector<int> vi;
ll ans=0;
int gh[20];
ll dp[20][164][2];
ll getsum(int idx,int n,ll sum,bool flag){
		ans=max(sum,ans);
	if(idx>n)return sum;
	if(dp[idx][sum][flag]!=-1)return dp[idx][sum][flag];
	int limit=9;
	if(!flag)limit=gh[idx];
	ll res=0;
	for(int i=0;i<=limit;i++){
		if(i<limit||flag){
			res+=getsum(idx+1,n,sum+i,true);
		}
		else{
			res+=getsum(idx+1,n,sum+i,false);
		}
	}
	return dp[idx][sum][flag]=res;
}
void solve(){
	string b;
	cin>>b;
	for(int i=0;i<b.size();i++){
		gh[i+1]=b[i]-'0';
	}
	memset(dp,-1,sizeof dp);
  ll r=getsum(1,b.size(),0,0);
   cout<<ans<<"\n";
}

int main(){
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);
   int t=1;
  // cin>>t;
     while(t--){
     	solve();
	 }
     return 0;
}

Measured memory_bytes: 3620
a,b = [int(x) for x in input().split()]

if a > 0:
    print("Positive")
elif a <= 0 and b >= 0:
    print("Zero")
else:
    n = min(0,b) - a
    if n % 2 == 0:
        print("Negative")
    else:
        print("Positive")

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  int n, l;
  string s[100];
  cin >> n >> l;
  for (int i=0; i<n; ++i) cin >> s[i];

  sort(s, s+n);

  for (int i=0; i<n; ++i) cout << s[i];
  cout << "\n";
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8

from queue import Queue

N = int(input())
graph = [ list() for i in range(N+1)]
for i in range(N - 1):
    a, b = tuple(map(int, input().split()))
    graph[a].append(b)
    graph[b].append(a)

def search(start):
    dist = [0 for i in range(N+1)]
    is_visit = [False for i in range(N+1)]
    is_visit[start] = True
    q = Queue()
    q.put(start)

    while not q.empty():
        v = q.get()
        for u in graph[v]:
            if not is_visit[u]:
                is_visit[u] = True
                q.put(u)
                dist[u] = dist[v] + 1
    return dist

win_f = 0
win_s = 0
for f, s in zip(search(1)[2:N], search(N)[2:N]):
    if f <= s:
        win_f += 1
    else:
        win_s += 1
print("Fennec" if win_f > win_s else "Snuke")


Measured memory_bytes: 30816
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;


int dp[1000010];
int A[100010], B[100010];
void solve() {
	int H, N; cin >> H >> N;
	REP(i, N)cin >> A[i] >> B[i];
	REP(i, 1000000)dp[i] = INF;
	dp[0] = 0;
	REP(i, H + 1) {
		REP(j, N) {
			dp[i + A[j]] = min(dp[i + A[j]], dp[i] + B[j]);
		}
	}
	ll ans = INF;
	FOR(i, H, 1000000) {
		ans = min(ans, dp[i]);
	}
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




Measured memory_bytes: 8192
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt(),count=1;
		long sum = 0;
		Integer[] array = new Integer[3*N];

		for(int i=0;i<3*N;i++) {
			array[i] = sc.nextInt();
		}

		Arrays.sort(array, Collections.reverseOrder());
		for(int i=0;i<N;i++) {
			sum+=array[count];
			//System.out.println(array[count]);
			count+=2;
		}

		System.out.println(sum);
	}
}

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

#define int long long
#define INF 1e18

int func(string s, string t);

signed main() {
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    for(int i = 0; i < n - 1; i++) {
        int tmp = func(s.substr(0, i + 1), s.substr(i + 1, n - i - 1));
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

int func(string s, string t) {
    int cnt = 0;
    for(char c = 'a'; c <= 'z'; c++) {
        bool founds = false;
        bool foundt = false;
        for(int i = 0; i < s.size(); i++) {
            if(c == s[i]) founds = true;
        }
        for(int i = 0; i < t.size(); i++) {
            if(c == t[i]) foundt = true;
        }
        if(founds && foundt) cnt++;
    }
    return cnt;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long n,a,b,s=0;
    cin >> n >> a >> b;
    s = s+n/(a+b)*a;
    n = n%(a+b);
    if(n >= a)
        s += a;
    else
        s += n;
    cout << s;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;

void test(){
	ll n;
	cin>>n;
	ll a[n];
	f(i,n)cin>>a[i];
	int ans = -1;
	stack<int> st;
	f(i,n){
		if(st.empty()){
			st.push(a[i]);
		}else{
			if(ans==-1){
				if(a[i]!=st.top()){
					if(a[i]<st.top()){
						ans = 0;
					}else{
						ans = 1;
					}
					st.push(a[i]);
				}else{
					// let it go
				}
			}else{
				if(ans==0 and st.top()>a[i]){
					st.pop();
					st.push(a[i]);
				}else if(ans==1 and st.top()<a[i]){
					st.pop();
					st.push(a[i]);
				}else if(a[i]!=st.top()){
					st.push(a[i]);
					ans = 1-ans;
				}
			}
		}
	}
	vector<int> res;
	while(!st.empty()){
		res.pb(st.top());
		st.pop();
	}
	if((int)res.size()<=1){
		cout<<"1000\n";
		return ;
	}
	reverse(res.begin(),res.end());
	
	ll amount = 1000, stock = 0;
	
	// f(i,res.size())cout<<res[i]<<" ";
	// cout<<"\n";
	
	f(i,(int)res.size()-1){
		if(res[i]<res[i+1]){
			// buy 
			stock = amount/res[i] ;
			amount = amount%res[i];
		}else{
			// sell
			amount = amount + (stock*res[i]);
			stock = 0;
		}
	}
	amount = amount + (stock*res[res.size()-1]);
	cout<<amount<<"\n";
	
}

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


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

using namespace std;

typedef long long ll;

int main(){
	int x;
	cin >> x;
	int r = x%100;
	int ans=0;
	for (int b = 0; b <= r ; b++){
		for (int c = 0; c <= r/2 ; c++){
			for (int d = 0; d <= r/3 ; d++){
				for (int e = 0; e <= r/4 ; e++){
					for (int f = 0; f <= r/5 ; f++){
						int total = b+2*c+3*d+4*e+5*f;
						if (total == r)
						{
							if(100*(b+c+d+e+f)+total <= x){
								ans = 1;
								break;
							}
						}					
					}
				}
			}
			
		}
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int h,w;cin>>h>>w;
    string s;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>s;
            if(s=="snuke"){
                cout<<char('A'+j)<<i+1<<endl;
                break;
            }
        }
    }
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a,b,c,x,y;
	cin >> a >> b >> c >> x >> y;
	int  ans = 0;
	ans += min(x, y)*min(a + b, 2*c);
	if (x > y)ans += min(a, 2 * c)*(x - y);
	if (y > x)ans += min(b, 2 * c)*(y - x);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);

#define debug(x) (#x " : " + to_string(x))
#define debug_cout(x) (cout << #x << " : " <<  to_string(x) << endl)
#define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(ll i=1, i##_len=(n); i<i##_len; i++)
#define rrep(i, n) for(ll i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(ll i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair((a), (b));
using namespace std;
using ll = long long;
//#define int long long
template<class T> bool chmax(T& a, T& b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T& b) { if (a > b) { a = b; return true; } return false; }
constexpr int INF = 2e9;

/*****/

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

	cout << (3 * r * r) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

int main(){
	int n, m, x;
	cin>>n>>m>>x;
	vector<int>c(n,0);
	vector<vector<int> >v(n,vector<int>(m,0));
	for(int i=0; i<n; i++){
		cin>>c[i];
		for(int j=0; j<m; j++){
			cin>>v[i][j];
		}
	}	
	int sum=-1;
	for(int i=0; i<pow(2,n); i++){
		vector<int>value(m,0);
		int temp=0;
		//cout<<"\n";
		for(int j=0; j<n; j++){
			if(i&(1<<j)){
				//cout<<"1";
				temp+=c[j];
				for(int k=0; k<m; k++){
					value[k]+=v[j][k];
				}
			}
		//		cout<<"0";
		}
		//cout<<": |";
		bool check=true;
		for(int j=0; j<m; j++){
		//	cout<<value[j]<<"|";
			if(value[j]<x)
				check=false;
		}
		//cout<<" : "<<temp;
		if(check)
			sum=sum>=0?min(sum,temp):temp;	
	}
	cout<<sum<<"\n";
}


Measured memory_bytes: 4116
#include<bits/stdc++.h>
using namespace std;
#ifndef d
#define d(...)
#endif
#define st first
#define nd second
#define pb push_back
#define siz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
typedef long long LL;
typedef long double LD;
constexpr int INF=1e9+7;
constexpr LL INFL=1e18;
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag,
         tree_order_statistics_node_update>;
*/

constexpr int mod = INF, maxn = 200005;

int n, col[maxn];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i=1; i<=n; i++)
		cin >> col[i];
	
	vector<int> cnt(*max_element(col+1, col+n+1) + 1);
	vector<int> res(n+1), lst(cnt.size(), -1);
	res[0] = 1;
	for(int i=1; i<=n; i++) {
		res[i] = res[i-1];
		if(lst[col[i]] != i-1) {
			res[i] = (res[i-1] + cnt[col[i]]) % mod;
			// cerr << make_pair(i, res[i]) << endl;
			cnt[col[i]] += res[i-1];
		}
		lst[col[i]] = i;
		if(cnt[col[i]] >= mod)
			cnt[col[i]] -= mod;
	}
	
	cout << res[n] << "\n";





	return 0;
}


Measured memory_bytes: 3456
import java.util.Scanner;

public class Main {
	static Scanner in;
	static String[] line;
	static int n;
	
	public static void main(String[] args){
		in = new Scanner(System.in);
		while(true){
			n = in.nextInt();
			if(n==0) break;
			
			line = new String[n];
			for(int i=0;i<n;i++){
				line[i] = in.next();
			}
			now = 0;
			System.out.println(calc('+',0));
			System.gc();
		}
	}
	static int now;
	public static int calc(char op,int level){
		int ans = (op=='+')?0:1;
		while(true){
			if(now>=n) return ans;
			String next = line[now];
			if(level>0 && (level-1>=next.length() || next.charAt(level-1)!='.')){
				return ans;
			}
			if(next.charAt(level)=='+'){
				if(op=='+'){
					now++;
					ans += calc('+',level+1);
				}else{
					now++;
					ans *= calc('+',level+1);
				}
			}else if(next.charAt(level)=='*'){
				if(op=='+'){
					now++;
					ans += calc('*',level+1);
				}else{
					now++;
					ans *= calc('*',level+1);
				}
			}else{
				if(op=='+'){
					now++;
					ans += next.charAt(level)-'0';
				}else{
					now++;
					ans *= next.charAt(level)-'0';
				}
			}
		}
	}
}

Measured memory_bytes: 34052
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>

int main()
{
	int n;

	while(std::cin >> n)
	{
		int checkLimit = sqrt((double)n);

		std::vector<bool> Prime(n+1,true);

		Prime[0] = false;

		Prime[1] =false;
		
		for(int i=2; i<checkLimit+1; ++i)
		{
			if(!(Prime[i]))
			{
				continue;
			}

			for(int j=2*i; j<n+1; j+=i)
			{
				Prime[j] = false; 
			}

		}

		std::cout << std::count(Prime.begin(),Prime.end(),true) << '\n';
	}
}

Measured memory_bytes: 1316
s = int(input())
dic = {}
i = 0
while True:
    if s not in dic:
        dic[s] = i
        i += 1
        if s % 2 == 0:
            s = s // 2
        else:
            s = 3 * s + 1
    else:
        print(i + 1)
        break

Measured memory_bytes: 38384
#include<iostream>
using namespace std;
int main()
{

    int n,i,j,sum,min,flag=0;
    cin>>n;
    int ara[n];
    for(i=0;i<n;i++) cin>>ara[i];
    min=2147483647;
    for(i=-100;i<=100;i++){
        sum=0;
        for(j=0;j<n;j++){

         sum=sum+((ara[j]-i)*(ara[j]-i));
        }
        if(sum<min) min=sum;
    }
    cout<<min<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>

using namespace std;

int main(){
  int N, M , j;
  while(cin >> N >> M , N){
    int mas[N + 1], ok = -1;
    for(int i = 1 ; i <= N ; i++ ) cin >> mas[i];
    int now = 1;
    for(j = 1 ; j <= M ; j++ ){
      int d;
      cin >> d;
      now = min(now + d, N);
      if(now == N && ok == -1) ok = j;
      now = max(0, min(now + mas[now], N));
      if(now == N && ok == -1) ok = j;
    }
    cout << ok << endl;
  }
}

Measured memory_bytes: 1164
//18
#include<iostream>
#include<cmath>

using namespace std;

double r,l,p,e,t;

double dfs(int k,double r,double l){
  if(k==0){
    return fabs((r+l)/2-t)<=e;
  }else if(t+e<r||l<t-e){
    return 0;
  }else if(t-e<=r&&l<=t+e){
    return 1;
  }else{
    double h=(r+l)/2;
    double hp=(h>t)?p:1-p;
    return dfs(k-1,h,l)*hp+dfs(k-1,r,h)*(1-hp);
  }
}

int main(){
  int k;
  double r,l;
  cin>>k>>r>>l>>p>>e>>t;
  cout.precision(5);
  cout<<fixed<<dfs(k,r,l)<<endl;
  return 0;
}
  

Measured memory_bytes: 1292
#include <bits/stdc++.h>
#include <iostream>
typedef long long ll;
#define rep(i,a,b) for(ll i =a ;i <= b;i++)
#define per(i,a,b) for(ll i =a ;i >= b;i--)
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;


int main(int argc, char const *argv[])
{
	//ifstream cin("input.txt");
	int n;
	cin>>n;
	ll sum = 0;
	rep(i,1,n)
	{

		if(i%3 != 0 && i%5 != 0)
			sum+=i;

	}
	cout<<sum;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define ld long double
#define MOD 1000000007
#define nl cout << bl
#define rt ll Q[100005] = {0}
#define mp make_pair
#define test() \
    ull t;     \
    cin >> t;  \
    while (t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define s(ar, n) sort(ar, ar + n)
#define rs(ar, n) sort(ar, ar + n, greater<ll>())
#define oa(a, n)               \
    for (ll i = 0; i < n; i++) \
        cout << a[i] << " ";
#define cn(a, n)               \
    for (ll i = 0; i < n; i++) \
        cin >> a[i];
#define ov(a, n)                    \
    for (ll i = n - 1; i >= 0; i--) \
        cout << a[i] << " ";        \
    nl
#define ovp(a, n)              \
    for (ll i = 0; i < n; i++) \
        cout << a[i].ff << " " << a[i].ss << bl;
#define maxa(ar, N) *max_element(ar, ar + N)
#define mina(ar, N) *min_element(ar, ar + N)
#define present(c, x) ((c).find(x) != (c).end())
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
typedef pair<int, int> pii;
ll fast_exp(ll base, ll exp)
{
    ll res = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return res % MOD;
}
ll fib(ll n)
{
    if (n < 2)
        return n;
    ll a = 0, b = 1, pre;
    int i = 1;
    while (i < n)
    {
        pre = (a + b) % MOD;
        a = b;
        b = pre;
        i++;
    }
    return pre;
}
ll fac(ll n)
{
    if (n % 2 == 0)
        return 2;

    for (ll i = 3; i * i <= n; i += 2)
    {
        if (n % i == 0)
            return i;
    }

    return n;
}
ll fact(ll n)
{
    if (n > 1)
        return n * fact(n - 1);
    else
        return 1;
}
bool sortbysec(const tuple<int, int, int> &a,
               const tuple<int, int, int> &b)
{
    return (get<1>(a) < get<1>(b));
}
int last_digit(int n)
{
    int ans = 0;
    while (n != 0)
    {
        ans = n % 10;
        n /= 10;
    }
    return ans;
}
int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    set<pair<int, int>> points;
    vector<int> row(n + 1, 0);
    vector<int> col(m + 1, 0);
    while (x--)
    {
        int i, j;
        cin >> i >> j;
        points.insert({i, j});
        row[i]++;
        col[j]++;
    }
    int mxr = *max_element(all(row));
    int mxc = *max_element(all(col));
    vector<int> rows;
    vector<int> cols;
    for (int i = 0; i <= n; i++)
    {
        if (row[i] == mxr)
        {
            rows.pb(i);
        }
    }
    for (int i = 0; i <= m; i++)
    {
        if (col[i] == mxc)
        {
            cols.pb(i);
        }
    }
    int ans = mxc + mxr - 1;
    for (auto i : rows)
    {
        bool flag = 0;
        for (auto j : cols)
        {
            if (points.count({i, j}) == 0)
            {
                ans++;
                flag = true;
                break;
            }
        }
        if (flag)
        {
            break;
        }
    }
    cout << ans;
}


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

int main()
{
    string s,last;
    cin >> s;
    int n = s.size();
    last = s[0];
    int ans = 1 , lastsiz = 1;
    for(int i = 1 ; i < n ; i += 1){
        string g;
        g = g + s[i];
        if(lastsiz == 1 && g == last && i < n-1){
            last = s[i] + s[i+1];
            ans += 1;
            lastsiz = 2;
            i += 1;
        }else if(lastsiz == 1 && g == last && i == n-1){
            break;
        }else if(lastsiz == 1 && g != last){
            ans += 1;
            last = s[i];
        }else if(lastsiz == 2){
            ans += 1;
            last = s[i];
            lastsiz = 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
n = int(input())
s = input()

sr = [] 
sg = []
sb = [0] * n
kcnt = 0
for i in range(n):
  if s[i] == 'R':
    sr.append(i)
  elif s[i] == 'G':
    sg.append(i)
  else:
    sb[i] = 1
    kcnt += 1

ans = 0
for i in sr:
  for j in sg:
    nki = j*2 - i
    nkj = i*2 - j
    nkk = (j+i)
    ans += kcnt
    if  0<= nki < n and sb[nki] == 1:
        ans -= 1
    if 0<= nkj < n and sb[nkj] == 1:
        ans -= 1
    if nkk%2 == 0 and 0<= (nkk//2) < n and sb[nkk//2] == 1:
      ans -= 1

print(ans)

Measured memory_bytes: 9248
while True:
    try:
        a = list(int(x) for x in input().split())
        b = list(int(x) for x in input().split())
    except EOFError:
        break
    hit = 0
    brow = 0
    for i in range(4):
        if a[i] == b[i]:
            hit += 1
        else:
            for j in range(4):
                if(i != j and a[i] == b[j]):
                    brow += 1
                    
    print(str(hit) + " " + str(brow))


Measured memory_bytes: 5600
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

std::string Replace( std::string String1, std::string String2, std::string String3 )
{
    std::string::size_type  Pos( String1.find( String2 ) );

    while( Pos != std::string::npos )
    {
        String1.replace( Pos, String2.length(), String3 );
        Pos = String1.find( String2, Pos + String3.length() );
    }

    return String1;
}

int main() {
  string S; cin >> S;
  while (true) {
    if (S.size() == 0) {
      cout << "YES" << endl;
      return 0;
    }

    if (S.size() >= 7 && S.substr(S.size() -7, 7) == "dreamer") {
      S = S.substr(0, S.size() -7);
      continue;
    }
    if (S.size() >= 6 && S.substr(S.size() -6, 6) == "eraser") {
      S = S.substr(0, S.size() -6);
      continue;
    }
    if (S.size() >= 5 && S.substr(S.size() -5, 5) == "dream") {
      S = S.substr(0, S.size() -5);
      continue;
    }
    if (S.size() >= 5 && S.substr(S.size() -5, 5) == "erase") {
      S = S.substr(0, S.size() -5);
      continue;
    }
    cout << "NO" << endl;
    return 0;
  }
}


Measured memory_bytes: 544
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
    string s;
    cin>>s;
    int q;
    cin>>q;
    bool hanten=false;
    for(int i=0; i<q; i++){
        int t;
        cin>>t;
        if(t==1){
            if(hanten){
                hanten=false;
            }else{
                hanten=true;
            }
        }else{
            int f;
            cin>>f;
            string c;
            cin>>c;
            if(f==1){
                if(hanten){
                    s+=c;
                }else{
                    s.insert(0, c);
                }
            }else{
                if(hanten){
                    s.insert(0, c);
                }else{
                   s+=c;
            }
        }
    }}
    if(hanten) reverse(s.begin(), s.end());
    cout<<s<<endl;
}


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

class light{
    public:
    int k;
    vector<int> ks;
    int p;
};

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

    light L[M];

    for(int i=0;i<M;i++){
        cin >> L[i].k;
        L[i].ks.resize(L[i].k);
        for(int j=0;j<L[i].k;j++){
            cin >> L[i].ks.at(j);
            L[i].ks.at(j) -=1;
        }
    }

    for(int i=0;i<M;i++){
        cin >> L[i].p;
    }

    int ans = 0;

    for(int i=0;i < 1<<N; i++){
        bool flg = true;
        for(int a=0;a<M;a++){
            int c = 0;
             for(int j=0;j<L[a].k;j++){
                 if(i >> L[a].ks[j] & 1){
                     c++;
                 }
             }
            if(c%2 != L[a].p){
                flg = false;
                break;
            }
        }
        if(flg) ans++;
    }

    cout << ans << "\n";
    return 0;
}








    

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int S(int n){
  int result = 0;
  while(n){
    result += n % 10;
    n /= 10;
  }
  return result;
}

int main(){
  int n;
  std::cin >> n;

  if(n % S(n) == 0){
    std::cout << "Yes" << '\n';
  }else{
    std::cout << "No" << '\n';
  }
  return 0;
}


Measured memory_bytes: 888
A, B = map(int, input().split())
cnt = 0
for i in range(A, B+1):
    flag = True
    chr_i = str(i)
    re_chr_i = chr_i[::-1]
    for j in range(len(chr_i)):
        if chr_i[j]!=re_chr_i[j]:
            flag = False
            break
    if flag:
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N,K,D;
  cin>>N>>K;
  
  set<long long> T;
  long long count=0;
  
  for(long long i=0;i<K;i++){
    long long D;
    cin>>D;
    for(long long k=0;k<D;k++){
      long long A;
      cin>>A;
      T.insert(A);
    }
  }
  
  for(long long p=1;p<=N;p++){
    if(T.count(p)) count++;
  }
  cout<<N-count;
}

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

using namespace std;

int main(){ 
    long long A, B, K;
    cin >> A >> B >> K;

    long long tmp = 0;
    if(A < K){
        tmp = K - A;
        cout << 0 << " " << max((long long)(0), B - tmp) << endl;
    }else{
        cout << A - K << " " << B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

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

bool prime(int n) {
  for (int i = 2; i <= sqrt(n); ++i) {
    if (n % i == 0) { return false; }
  }
  return n != 1;
}

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

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

vector< vector<int> > tree;
vector<int> dst;  // distance
int r = 0;

void dfs(int now, int p) {
  for (auto x : tree[now]) {
    if (x == p) { continue; }
    dst[x] = dst[now] + 1;
    if (dst[x] > dst[r]) { r = x; }
    dfs(x, now);
  }
}

int main(int argc, char** argv) {
  int N;
  cin >> N;
  if (N == 1) { // If N is 1, first wins.
    cout << "First" << endl;
    return 0;
  }
  tree.resize(N);
  dst.resize(N);

  rep(i, N-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }

  // Double-Sweep for calculating the diameter of a tree.
  // cf. https://www.slideshare.net/chokudai/arc022 C
  dfs(0, -1);  // At first, start dfs from a random position.
  dst[r] = 0;
  dfs(r, -1);  // Next, start dfs from the farthest position.
  int diameter = dst[r];

  if (diameter % 3 == 1) {
    cout << "Second" << endl;
  } else {
    cout << "First" << endl;
  }
}


Measured memory_bytes: 21376
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return a;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


int main() {
  int H,W; cin >>H >>W;
  int N; cin >>N;
  vector<int> A(N); rep(i, N) cin >>A.at(i);
  vector<int> color(H*W);
  int tmpi = 0;
  for (int i=0; i<H*W; i++){
    if (A.at(tmpi)==0) tmpi++;
    color.at(i) = tmpi+1;
    A.at(tmpi)--;
  }
  vector<vector<int>> table(H, vector<int>(W, 0));

  int colori = 0;
  for (int i=0; i<H; i++){
    if (i%2==0){
      for (int j=0; j<W; j++){
        table.at(i).at(j) = color.at(colori);
        colori++;
      }
    }
    if (i%2==1){
      for (int j=W-1; j>=0; j--){
        table.at(i).at(j) = color.at(colori);
        colori++;
      }
    }
  }

  for (int i=0; i<H; i++){
    for (int j=0; j<W; j++){
      cout <<table.at(i).at(j);
      if (j == W-1) cout <<endl;
      else cout <<" ";
    }
  }

}

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

int main(){
  int X;
  cin >> X;
  for(int i=X;i<1e9;i++){
    bool flag=true;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
        flag=false;
        break;
      }
    }
    if(flag){
      cout << i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
    using namespace std;
    using namespace __gnu_pbds;
    #define ll long long
    #define int long long
    #define pb push_back
    #define For(i,n) for(ll  i=0;i<n;i++)
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;clock_t clk = clock();
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define ld long double
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define fi first
    #define se second
    #define pii pair<ll,ll>
    #define endl "\n"
    #define sz(x) (int)(x).size()
    #define what_is(x) cerr << #x << " is " << x << endl;
    #define time cerr << "Time (in ms): " << double(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';
    const double pi=3.14159265358979323846264;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
/*.....................................................................................................................*/

    ll mod =(ll)1e9+7;
    ll add(ll x,ll y) {return (x+y)%mod;}
    ll mult(ll x, ll y){return ((x%mod )* (y%mod)) % mod;}
    long long binpow(long long x, long long p) 
    {
        if (p == 0) return 1;
    	if (p == 2 || (p & 1)) return mult(x, binpow(x, p - 1));
    	return binpow(binpow(x, p / 2), 2);
    }
    ll modinv(ll a) {return binpow(a,mod-2);}
    // bool check(ll x){}
    ll binsearch(ll l,ll r)
    {
        while(l<r)
        {
            ll mid=(l+r)/2;
            // if(check(mid))r=mid;
            // else l=mid+1;
        }
        return l;
    }
    const ll man=(ll)1e3+5;
    vector<ll>adj[man];
    bool vis[man][man];
    ll d[man],depth[man],par[man];
    void addedge(ll u,ll v){adj[u].pb(v);adj[v].pb(u);}
    ll dx[4]={1,-1,0,0};ll dy[4]={0,0,1,-1};
/*........................................................................................................................*/


signed main()/*Check flow...question galat mat padhna */
{
    fast;
    string a[7]={"SUN","MON", "TUE", "WED", "THU", "FRI",  "SAT" };
    string s;
    cin>>s;
    ll x=0;
    For(i,7)
    {
        if(s==a[i])
        {
            x=i;
        }
    }
    cout<<7-x<<endl;
}



Measured memory_bytes: 3672
from sys import stdin, setrecursionlimit


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    n, k = map(int, input().split())
    ans = 0
    for i in range(k, n + 2):
        ans += (n - i + 1) * i + 1
        ans %= mod
    print(ans % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 63132
#include<bits/stdc++.h>
using namespace std;
int a,b;
int c=0,d=0;
int main() {
	cin>>a>>b;

	for(int i=a; i<=b; i++) {
		if(i==0) {
			cout<<"Zero"<<endl;
			return 0;
		}
		if(i<0) {
			c++;
		}
		if(i>0) {
			d++;
		}
	}
	if(c%2==0) {
		cout<<"Positive"<<endl;
		return 0;
	} else {
		cout<<"Negative"<<endl;
		return 0;
	}
	if(c==0) {
		cout<<"Positive"<<endl;
		return 0;
	}
}

Measured memory_bytes: 256
DP = [False]*100001
DP[0] = True
for TN in range(0,100001):
    if TN>=100 and DP[TN-100]:
        DP[TN] = True
        continue
    if TN>=101 and DP[TN-101]:
        DP[TN] = True
        continue
    if TN>=102 and DP[TN-102]:
        DP[TN] = True
        continue
    if TN>=103 and DP[TN-103]:
        DP[TN] = True
        continue
    if TN>=104 and DP[TN-104]:
        DP[TN] = True
        continue
    if TN>=105 and DP[TN-105]:
        DP[TN] = True
        continue
print([0,1][DP[int(input())]])

Measured memory_bytes: 9544
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int H, W;
    cin >> H >> W;
    int h, w;
    cin >> h >> w;

    int res = H * W - h * W - H * w + h * w;

    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 256
#include"stdio.h"
int main()
{
	long a,b,c;
	int num=0;
	while((scanf("%ld%ld",&a,&b))!=EOF)
	{
		c=a+b;
		while(c!=0)
		{
			c=c/10;
			num++;
		}
		printf("%d\n",num);
		num=0;
	}
	return 0;
}

Measured memory_bytes: 600
N=int(input())
A=list(map(int,input().split()))
cumulative_sum=0
count=0
counter={0:1}
for a in A:
    cumulative_sum+=a
    if cumulative_sum not in counter:
        counter[cumulative_sum]=0
    count+=counter[cumulative_sum]
    counter[cumulative_sum]+=1
print(count)

Measured memory_bytes: 38676
#coding:utf-8

N = int(input())

A = [int(y) for y in input().split()]

M = max(A)

L1 = [False] * (M+1)
L2 = [0] * (M+1)

for i in A:
    if L2[i] == 1:
        L1[i] = True
    
    d = i * 2
    L2[i] = 1
    
    while d <= M:
        L1[d] = True
        d += i

count = 0

for i in A:
    if not L1[i]:
        count += 1

print("{}".format(count))

Measured memory_bytes: 34824
#include<stdio.h>
 
char f[5000];
char match[5000][5000];
int rank[5000];
int num,n;
 
void func(int i){
    int j;
    if(f[i-1]==1) return;
    f[i-1]=1;
    for(j=1;j<=n;j++){
    	if(match[j-1][i-1]) func(j);
    }
    printf("%d\n",i);
    rank[num]=i-1;
    num++;
}
 
int main(){
    long i;
    int j,k;
    long m;
    int w,l;
    int flag;
    scanf("%d",&n);
    scanf("%ld",&m);
    for(i=0;i<m;i++){
        scanf("%d %d",&w,&l);
        match[w-1][l-1]=1;
    }
    for(j=1;j<=n;j++){
        func(j);
    }
    flag=1;
    for(j=0;j<n-1;j++){
    	if(match[rank[j]][rank[j+1]]==0){
    		flag=0;
    		break;
    	}
    }
    if(flag) printf("0\n");
    else printf("1\n");
    return 0;
}

Measured memory_bytes: 25032
N,H,W = input().split()

N=int(N)
H=int(H)
W=int(W)

count = 0
for i in range(N):
    a, b = input().split()
    a = int(a)
    b = int(b)

    ch = a // H
    cw = b // W

    count += min(ch,cw)
print(count)

Measured memory_bytes: 3064