akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define long long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define fill(a,v) memset(a,v,sizeof(a))
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define INF 0x3f3f3f3f//infinity for integers
#define JJ ios_base::sync_with_stdio(0); cin.tie(0)//input fast
#define MOD 1000000007
#define hash(n) unordered_map<int,int>mp(n)
bool comp(int a, int b){
	return a>b;
}

int main() 
{ 
	JJ;
	int n; cin>>n;
	int r=n%10;
	if(r==0 || r==1|| r==6 || r==8){
		cout<<"pon"<<endl;
	}
	else if(r==3)
		cout<<"bon"<<endl;
	else
		cout<<"hon"<<endl;




	return 0;



    
} 

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;


int main() {
    string s;
    cin >> s;
    ll K;
    cin >> K;
    
    map<string, ll > mp;
    ll len = s.length();
    for(ll i = 0; i < min(len , 5LL); i++){
        for(ll j = 0; j < len - i; j++){
            mp[s.substr(j, i + 1)]++;
            //cout << s.substr(j, i + 1) << endl;
        }        
    }

    ll cn = 0;
    auto begin = mp.begin(), end = mp.end();
    for (auto iter = begin; iter != end; iter++) {
        if(cn == K - 1){
            cout << iter->first << endl;
            return 0;
        }
        cn++;
    }
}

Measured memory_bytes: 1920
import sys
def I(): return int(sys.stdin.readline().rstrip())

K = I()

A = [i for i in range(1,100)]  # Snuke数の候補

for i in range(13):
    for j in range(100,1000):
        A.append(j*10**i+10**i-1)

A.sort(reverse=True)
B = []
m = 10**18
for a in A:
    x = a/sum(int(i) for i in list(str(a)))
    if x <= m:
        B.append(a)
        m = x

B.reverse()
print(*B[:K],sep='\n')


Measured memory_bytes: 74052
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N, M = inpl()
AC = [False]*N
WA = [0]*N
for i in range(M):
    p, S = input().split()
    p = int(p)
    if S == 'AC':
        AC[p-1] = True
    else:
        if not AC[p-1]:
            WA[p-1] += 1
ans = 0
acs = 0
pens = 0
for i in range(N):
    if AC[i]:
        acs += 1
        pens += WA[i]
print(acs, pens)

Measured memory_bytes: 42220
function Main(input) {
    var ud = input.split('\n');
    var uu = ud[0].split(' ');
    var dd = ud[1].split(' ');

    var N = Number(uu[0]);
    var K = Number(uu[1]);
    var A = dd.map((n) => Number(n));
    var oneIdx = A.indexOf(1);
    var Alen = A.length;
    console.log(Math.ceil((N - K) / (K - 1) + 1));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 16716
n, m = map(int, input().split())
count_wa = 0
count_ac = 0
if m == 0:
    print('0 0')
    exit()
al = [False] * n
wa_list = [0] * n
while True:
    try:
        p, s = map(str, input().split())
        if s == 'AC' and not al[int(p) - 1]:
            count_ac += 1
            al[int(p) - 1] = True
        elif s == 'WA' and not al[int(p) - 1]:
            wa_list[int(p) - 1] = wa_list[int(p) - 1] + 1
    except:
        break
for al_i in range(len(al)):
    if al[al_i]:
        count_wa = count_wa + wa_list[al_i]
print(str(count_ac) + ' ' + str(count_wa))


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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string S;
	cin >> S;
	if (S[0] == S[1] && S[1] == S[2]) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int a;
    cin >> a;
    if (a < 1200) cout << "ABC" << endl;
    else if (a < 2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
}

Measured memory_bytes: 256
from collections import defaultdict as dd
from collections import Counter
from pprint import pprint as pp

YN = {True: 'Yes', False: 'No'}
ri = lambda: int(input())
ria = lambda: list(map(int, input().split()))
rian = lambda n: [ria() for _ in range(n)]
rs = lambda: input()
rsa = lambda: input().split()
rsn = lambda n: [rs() for _ in range(n)]

A,B = ria()
print(max((A+B, A-B, A*B)))

Measured memory_bytes: 3820
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int[] a=new int[5];
        for(int i=0;i<5;i++){
          a[i] = sc.nextInt();
        }
        int k = sc.nextInt();
        int flag=0;
        for(int i=0;i<4;i++){
          for(int j=i+1;j<5;j++){
            flag+=(a[j]-a[i])>k?1:0;
          }
        }
        // 出力
        System.out.println(flag>0?":(":"Yay!");
    }
}


Measured memory_bytes: 23380
#include <iostream>
#include <cstdio>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--)
using namespace std;
const int N = 1e5 + 10;
pair<int, int> f[N];
int n, k, a[N], ans = 0;
struct edge{ int to, pre; } e[N << 1]; int u[N], l = 0;
void ins(int a, int b) { e[++l] = (edge){b, u[a]}, u[a] = l; }
#define v e[i].to
#define reg(i,a) for(int i = u[a]; i; i = e[i].pre)

void dfs(int x, int fa) {
	reg(i,x) if (v != fa) dfs(v, x);
	f[x].second = 1;
	reg(i,x) if (v != fa)
		f[x].first += f[v].first, 
		f[x].second = max(f[x].second, f[v].second + 1);
	if (fa && fa != 1 && f[x].second == k) f[x].first++, f[x].second = 0;
}

int main() {
	scanf("%d%d",&n,&k);
	rep(i,1,n) scanf("%d",a + i);
	if (a[1] != 1) ans++;
	rep(i,2,n) ins(a[i], i);
	dfs(1, 0);
	printf("%d\n",ans + f[1].first);
	return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i< (n); i++)
#define REP(i,n) for (int i = 1; i<= (n); i++)
#define MAX_MOD 1000000007LL
#define MOD 998244353LL
const long double PI = acos(-1);
using ll = long long;
using ld = long double;
using namespace std;

int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if (a==0) {
        cout << 1 << endl;
    } else if (b==0) {
        cout << 2 << endl;
    } else if (c==0) {
        cout << 3 << endl;
    } else if (d==0) {
        cout << 4 << endl;;
    } else if (e==0) {
        cout << 5 << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  string s;
  cin>>s;
  int a[26];
  rep(i,26) a[i]=0;
  rep(i,s.size()){
    a[s[i]-97]++;
  }
  rep(i,26){
    if(a[i]%2!=0){cout<<"No"<<endl;return 0;}
  }
  cout<<"Yes"<<endl;
  return 0;
}





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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}



int main() {
  int n;
  cin >> n;
  vector<vector<int>> tmp(n, vector<int>(26));
  rep(i, n){
    string s;
    cin >> s;
    for(char c : s){
      tmp[i][c - 'a']++;
    }
  }

  vector<int> ans(26);
  rep(i, 26){
    int tmp2 = 30000;
    rep(j, n){
      tmp2 = min(tmp2, tmp[j][i]);
    }
    ans[i] = tmp2;
  }

  rep(i, 26){
    int count = ans[i];
    rep(j, count){
      cout << (char)(i + 'a');
    }
  }
  cout << endl;
  return 0;
}


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

int main() {
 int n;
 cin >> n;
 vector<int> h(n);
 rep(i,n) cin >> h[i];
 int count = 1;
 int height = h[0];
 for(int i = 1; i<n; i++){
   if(height <= h[i]){
     count++;
   }
   height = max(height, h[i]);
 }
cout << count << endl;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

to = [0]*N

for i in range(N-1):
  if i == 0:
    SUM = A[i]
  else:
    SUM -= A[i-1]
  for j in range(min(to[i-1]+1,N-1),N):
    if SUM+A[j] != SUM^A[j]:
      to[i]=j-1
      break
    if j == N-1:
      to[i] = j
      break
    SUM += A[j]
  
print(sum([max(0,to[i]-i) for i in range(N)])+N)

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

int main(int argc, char const *argv[])
{
    int a, b, c;
    cin >> a >> b >> c;
    int ans = max({10*a+b+c, a+10*b+c, a+b+10*c});
    cout << ans << endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))

using namespace std;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n; cin>>n;
  int res = 0;
  
  for (int i = 1; i <= n; ++i) {
    if(i%2==0) continue;
    int c = 0;
    
    for (int j = 1; j <= i; ++j) {
      if(i%j==0) ++c;
    }
    
    if(c==8) ++res;
  }
  
  cout<<res;
    
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    ll Q, K;
    vector<vector<pair<ll, ll>>> V;
    stack<ll> st;
    vector<ll> distance;
    cin >> N;
    V.resize(N);
    distance.resize(N, -1);
    rep(i, N - 1) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        V[a].push_back({b, c});
        V[b].push_back({a, c});
    }
    cin >> Q >> K;
    distance[K - 1] = 0;
    st.push(K - 1);
    while(!st.empty()) {
        ll current = st.top();
        st.pop();
        iter(i, V[current]) {
            if(distance[i.first] == -1) {
                distance[i.first] = i.second + distance[current];
                st.push(i.first);
            }
        }
    }
    rep(i, Q) {
        ll x, y;
        cin >> x >> y;
        x--; y--;
        cout << distance[x] + distance[y] << endl;
    }
    return 0;
}


Measured memory_bytes: 9984
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

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

int main(){
    string s,t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int ma = 0;
    rep(i,n-m+1){
        int c = 0;
        for(int j=i;j<i+m;j++){
            if(s[j]==t[j-i]){
                c++;
            }
        }
        chmax(ma,c);
    }
    cout << m-ma << endl;
    return 0;
}

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

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=1e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

int a,b,c,d;

int main()
{
    read(a),read(b),read(c),read(d);
    int e=c/b,f=a/d;
    if(c%b)e++;
    if(a%d)f++;
    puts(e<=f?"Yes":"No");
    return 0;
}

Measured memory_bytes: 3620
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=2050;
//ここまでテンプレ
int main() {
	int X,Y,Z;
	cin>>X>>Y>>Z;
	int i;
	for(i=1;i<=100000;i++){
		if(Y*i+Z*(i+1)>X)
			break;
	}
	cout<<i-1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

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

using namespace std;
typedef long long ll;

int main()
{
    // Input
    int n;
    cin >> n;

    int ac = 0, wa = 0, tle = 0, re = 0;

    rep(i, n) {
        string s;
        cin >> s;

        if (s == "AC") {
            ac++;

        } else if (s == "WA") {
            wa++;

        } else if (s == "TLE") {
            tle++;

        } else {
            re++;
        }
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

    return 0;
}


Measured memory_bytes: 3168
N, M = map(int, input().split())
L = []
for m in range(M):
    L.append(list(map(int, input().split())))
P = list(map(int, input().split()))

ans = 0

for x in range(2 ** N):
    for m in range(M):
        c = 0
        for k in range(1, L[m][0]+1):
            ks_mk = -L[m][k]
            if int(format(x,'b').zfill(10)[ks_mk]) == 1:
                c += 1
        if c % 2 != P[m]:
            break
        if m == M-1:
            ans +=1

print(ans)


Measured memory_bytes: 3064
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int main()
 {
   int h,w;
   while(cin>>h>>w&&(h||w))
   {
     for(int i=0;i<h;i++)
     {
       for(int j=0;j<w;j++)
       {
         if(i%2==0)
         {
           if(j%2==0) cout<<"#";
           else cout<<".";          
         }
         else
         {
           if(j%2==0) cout<<".";
           else cout<<"#";    
         }
       }        
       cout<<endl;
     }
     cout<<endl;
   }
   //while(1);
   return 0;
 }

Measured memory_bytes: 3080
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define ABSS(a, b) (a > b ? a - b : b - a)

int main(void) {
	char s[11];
	char ans[11];

	scanf("%s", s);

	const size_t len = strlen(s);

	size_t pos = 0;
	ans[pos] = '\0';
	for (size_t idx = 0; idx < len; idx++) {
		if (s[idx] != 'B') {
			ans[pos] = s[idx];
			ans[pos + 1] = '\0';
			pos++;
		}
		else {
			if (pos > 0) {
				ans[pos - 1] = '\0';
				pos--;
			}
		}
	}

	puts(ans);

	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int x=0,i;
	char s[4];
	scanf("%s", &s);
	for(i=0; i<4; i++)
	{
		if(s[i]=='+')
		x++;
		else
		x--;
	}
	printf("%d\n", x);
	
	return 0;
}

Measured memory_bytes: 128
h , w = map(int,input().split())
ma = [list(input()) for i in range(h)]
ans = []
for i in range(h):
    kar = []
    for j in range(w):
        if ma[i][j] =="#":
            kar.append(j)
    ans.append(kar)


for i in range(h-1):
    if max(ans[i]) != min(ans[i+1]):
        print("Impossible")
        exit()
        
print("Possible")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ii pair<int, int>
#define iii tuple<int, int, int>
#define iiii tuple<int, int, int, int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define fi first
#define se second
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define uni(v) v.erase(unique(v.begin(), v.end()), v.end())
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (ll) a / __gcd(a, b) * b
#define rep(i, a, b) for (auto i = a; i != b; i += 1 - 2 * (a > b))

using namespace std;

void solve() {
    int t[3];
    cin >> t[0] >> t[1] >> t[2];
    sort(t, t + 3);
    if ((t[0] == t[1] || t[1] == t[2]) && t[0] != t[2]) cout << "Yes\n";
    else cout << "No\n";
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    // freopen("in", "r", stdin);

    int t = 1;
    // cin >> t;

    while (t--) solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,y,z;
	cin>>x>>y>>z;
	int k=z*x-y;
	for(int i=0;i<10;i++){
        cout<<k<<endl;
        k=k*x-y;


	}








    return 0 ;
}


Measured memory_bytes: 256
#!/usr/bin/python3

def addd(n):
    d = 0
    while n > 0:
        d += n % 10
        n //= 10
    return d


def main():
    N = int(input())

    best = 9 * 20
    for i in range(1, N):
        j = N - i
        best = min(best, addd(i) + addd(j))

    print(best)

if __name__ == '__main__':
    main()


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

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

    string s,t;
    cin >> s >> t;

    int n = s.length();
    bool r=false;
    REP(i,n){
        string tai = s.substr(0, n-i);
        string h = s.substr(n-i);

        string res = h+tai;
        if(res == t){
            r=true;
            break;
        }
    }
    if(r)YES;
    else NO;

}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	int N, A;
	cin >> N >> A;
	vector< int > X(N);
	rep(i, N) cin >> X[i];
	vector< int > Y(N);
	rep(i, N) Y[i] = X[i] - A;
	vector< vector< int > > dp(N + 1, vector< int >(5010, 0));
	dp[0][2500] = 1;
	for (int i = 1; i <= N; i++) {
		rep(j, 5010) dp[i][j] = dp[i - 1][j];
		int y = Y[i - 1];
		rep(j, 5010) {
			if (dp[i - 1][j] > 0) {
				dp[i][j + y] += dp[i - 1][j];
			}
		}
	}
	int ans = dp[N][2500] - 1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2304
N=int(input())
A=list(map(int,input().split()))
if min(A) == 0:
  print(0)
  exit()
else:
  ans =1
for i in range(N-1):
  ans *= A[i]
  if ans > 10**18:
    print(-1)
    exit()
ans *= A[N-1]
if ans > 10**18:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 21796
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

int N;
vector<pair<pi, int> > whole;

signed main(void) {
    cin>>N;
    rep(i, N) {
        int a,b; cin>>a>>b;
        whole.pb(mp(mp(a, b), 0));
    }
    rep(i, N) {
        int a,b; cin>>a>>b;
        whole.pb(mp(mp(a, b), 1));
    }
    sort(all(whole));
    rep(i, whole.size()) {
        cerr<<whole[i].fi.fi<<" "<<whole[i].fi.se<<" "<<whole[i].se<<endl;
    }
    vector<bool> used;
    rep(i, whole.size()) used.pb(false);
    int blue=0;
    int ans=0;
    rep(i, N) {
        while(whole[blue].se == 0) {
            blue++;
        }
        cerr<<"blue:"<<blue<<endl;
        int Mred=-1;
        int Mred_idx=-1;
        rep(red, blue) {
            if (!used[red] && whole[red].fi.se>Mred && whole[red].fi.se<whole[blue].fi.se) {
                Mred = whole[red].fi.se;
                Mred_idx = red;
            }
        }
        if (Mred>=0) { //ペアになれる赤が存在する
            cerr<<"red:"<<Mred_idx<<endl;
            ans++;
            used[Mred_idx]=true;
        }
        used[blue]=true;
        blue++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
using ll = long long;
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
vector<vector<ll>> vec(100,vector<ll>(3,0));
int main(){
  ll n,tmp1,tmp2,tmp3;
  cin >> n;
  rep(i,n){
    cin >> tmp1 >> tmp2 >> tmp3;
    vec[i][0] = tmp1;
    vec[i][1] = tmp2;
    vec[i][2] = tmp3;
  }
  ll ansh,ansx,ansy;
  ll tmph;
  bool can;
  rep(i,101){
    rep(j,101){
      tmph = -1;
      can = true;
      rep(k,n){
        tmp1 = vec[k][2] + abs(vec[k][0] - i) + abs(vec[k][1] - j);
        if(vec[k][2] == 0){
          if(tmph > tmp1){
            can = false;
            continue;
          }
        }else{
          if(tmph == -1){
            tmph = tmp1;
          }else{

            if(tmph != tmp1){
              can = false;
              break;
            }
          }
        }
      }
      if(can){
        ansh = tmph;
        ansx = i;
        ansy = j;
      }
    }
  }
  cout << ansx << " " << ansy << " " << ansh;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long x = sc.nextLong();
		Long y = 100L;
		Long year = 0L;

		while(y < x) {
			y = (long)(y * 1.01);
			year++;
		}

		System.out.println(year);

		sc.close();
	}
}

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

// repetition
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// const value
// const ll MOD = 1e9 + 7;
// const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
// const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<PII> p(n);
  rep(i, n) cin >> p[i].second >> p[i].first;
  ll current = 0;
  sort(all(p));
  rep(i, n) {
    current += p[i].second;
    if(current > p[i].first) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes"
       << "\n";
  return 0;
}


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

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define REP(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)((x).size()))

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e15+10;
const ll mod =   998244353;
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; }
#define print(x) cerr << #x << " is " << x << endl;

ll A[200000], B[200000];
map<int, int> M;

int MAX = 200005;
ll inv[200005];
// inv ���܂Ƃ߂ċ��߂�
void init_mod_inverse_all() {
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        //if (i < 100)fprintf(stderr, "%d, %d, %d\n", i, inv[i], inv[i] * i %mod);
    }
}


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

    ll nCk = 1;
    ll power[200005];
    power[0] = 1;
    reps(i, 1, N){
        power[i] = (power[i - 1] * (M - 1)) %mod;
    }

    // k = 0;
    ll ans = (nCk * M) % mod;
    (ans *= power[N - 1]) %= mod;

    for (int k = 1; k <= K; k++){
        (nCk *= (N - k)) %= mod;
        (nCk *= inv[k]) %= mod;
        ll tmp = (nCk * M ) %mod;
        (tmp *= power[N - 1 - k]) % mod;
        (ans += tmp) %= mod;
        //fprintf(stderr, "%d, %d\n", N - 1 - k, inv[k]);        
        // cout << k << " " << nCk <<  "x" << M <<"x" << power[N - 1 - k] << endl;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 6644
//Feel free to follow me.
//https://twitter.com/NishiakiGames

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,a[10000],b[10000],countA,countB;
    while(cin>>n,n!=0){
        countA=0,countB=0;
        for(int i=0;i<n;i++){
            cin>>a[i]>>b[i];
            if(a[i]>b[i]){
                countA+=(a[i]+b[i]);
            }else if(a[i]<b[i]){
                countB+=(a[i]+b[i]);
            }else{//a[i]==b[i]
                countA+=a[i];
                countB+=b[i];
            }
        }
        cout<<countA<<" "<<countB<<endl;
    }
    return(0);
}

Measured memory_bytes: 3116
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N;
  cin >> N;
  double ans = 0.0,a;
  for(int i = 0;i < N;i++){
    cin >> a;
    ans += 1.0/a;
  }
  ans = 1.0/ans;
  cout << fixed << setprecision(16) << ans << endl;
}


Measured memory_bytes: 3784
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();

		List<String> list = new ArrayList<String>() {
			{
				add("SUN");
				add("MON");
				add("TUE");
				add("WED");
				add("THU");
				add("FRI");
				add("SAT");
			}
		};

		System.out.println(7 - list.indexOf(s));
	}
}


Measured memory_bytes: 21716
#!/usr/bin/env python3
a,b = map(int,input().split())
s = input()
flag = 0
for i in range(a+b+1):
    if i < a or i > a :
        if ord(s[i]) < 48 or ord(s[i]) > 57:
            flag = 1
    elif s[i] != "-":
        flag = 1
print("Yes" if flag == 0 else "No")

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

using namespace std;

#define int long long 
#define M 1000000007

int h[300010],w[300010];

signed main(){
//	int t;
//	cin >> t;
//	while(t--){
		int m,wt,ht;
		cin >> ht >> wt >> m;
		map<pair<int,int>,int > mp;
		while(m--){
			int a,b;
			cin >> a >> b;
			mp[make_pair(a,b)]=1;
			h[a]++;
			w[b]++;
		}
		int mx=0,hans=0;
		for(int i=1;i<=ht;i++){
			if(h[i]>mx){
				hans=i;
				mx=h[i];
			}
		}
		mx=0;
		int wans=0;
		for(int i=1;i<=wt;i++){
			if(w[i]-mp[make_pair(hans,i)]>mx){
				wans=i;
				mx=w[i]-mp[make_pair(hans,i)];
			}
		}
		int ans1=h[hans]+w[wans]-mp[make_pair(hans,wans)];
		mx=0;
		wans=0;
		for(int i=1;i<=wt;i++){
			if(w[i]>mx){
				wans=i;
				mx=w[i];
			}
		}
		mx=0;
		hans=0;
		for(int i=1;i<=ht;i++){
			if(h[i]-mp[make_pair(i,wans)]>mx){
				hans=i;
				mx=h[i]-mp[make_pair(i,wans)];
			}
		}
		int ans2=h[hans]+w[wans]-mp[make_pair(hans,wans)];
		cout << max(ans1,ans2) << endl;
//	}
}
 

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

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;
 
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;

int main() {
  
  char a,b;
  cin >> a >> b;
  
  string x,y;
  
  for ( int i = 0; i < b - '0'; i++){
    x += a;
  }
  
  for ( int i = 0; i < a - '0'; i++){
    y += b;
  }
  
  cout << min(x,y) << endl;

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
        
int main()
{
    long long n, i, ans=1, cnt[1001]={0}, tmp, j;

    cin >> n;
    
    for(i=2;i<=n;i++){
        tmp=i;
        for(j=2;j<=i;j++){
            while(tmp%j==0){
                cnt[j]++;
                tmp=tmp/j;
            }
        }
    }
    for(i=2;i<=n;i++){
        ans=ans*(cnt[i]+1);
        ans=ans%1000000007;
    }
    
    cout << ans <<endl;
    return 0;
}

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

const int N = 100010;

typedef long long LL;

int fa[N]; 

struct edge {
    int to, next;
} e[N * 2];

int head[N], ecnt;

inline void adde(int from, int to) {
    e[++ecnt] = (edge){ to, head[from] }, head[from] = ecnt;
    e[++ecnt] = (edge){ from, head[to] }, head[to] = ecnt;
}

LL dp[N], a[N], b[N], sum[N];

void dfs(int u, int f) {
    sum[u] = b[u];
    for (int i = head[u]; i; i = e[i].next)
        if (e[i].to != f) dfs(e[i].to, u), sum[u] += sum[e[i].to];
    dp[u] = sum[u] + a[u];
    for (int i = head[u]; i; i = e[i].next)
        if (e[i].to != f) dp[u] = min(dp[u], sum[u] - sum[e[i].to] + max(a[u], dp[e[i].to]));
}

int id[N], vis[N]; vector<int> G[N];

int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }

int main() {
    int n, m; scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) scanf("%lld%lld", &a[i], &b[i]), a[i] = max(0ll, a[i] - b[i]);
    for (int i = 1; i <= n; i++) id[i] = fa[i] = i;
    for (int i = 1, a, b; i <= m; i++) scanf("%d%d", &a, &b), G[a].push_back(b), G[b].push_back(a);
    sort(id + 1, id + n + 1, [](int i, int j) { return a[i] < a[j]; }), vis[id[1]] = 1;
    for (int i = 2; i <= n; i++) {
        int u = id[i]; vis[u] = 1;
        for (auto v : G[u]) if (vis[v]) {
            if (find(u) == find(v)) continue;
            adde(find(v), u), fa[find(v)] = u;
        }
    }
    dfs(id[n], 0), printf("%lld\n", dp[id[n]]);
}

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

int main() {
  int X,A,B;
  cin >> X >> A >> B;
  
  if (A - B >= 0) cout << "delicious" << endl;
  else if (X + A - B >= 0) cout << "safe" << endl;
  else cout << "dangerous" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int deg[10];
int read() {
	char c=getchar(); int x=0,f=1;
	while (c<'0' || c>'9') {
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
int main() {
	for (int i=1; i<=3; i++) {
		int a=read(),b=read();
		++deg[a];
		++deg[b];
	}
	int cnt=0;
	for (int i=1; i<=4; i++) if (deg[i]&1) ++cnt;
	if (cnt==0 || cnt==2) printf("YES\n");
	else printf("NO\n");
	return 0;
}

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
#define guard(x) if( not ( x ) ) continue;
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int h, w; scan(h, w);
      Int ds[12][12];
      for(Int i = 0; i < 10; ++i) {
         for(Int k = 0; k < 10; ++k) {
            scan(ds[i][k]);
         }
      }
      for(Int k = 0; k < 10; ++k) {
         for(Int i = 0; i < 10; ++i) {
            for(Int j = 0; j < 10; ++j) {
               ds[i][j] = std::min(ds[i][j], ds[i][k] + ds[k][j]);
            }
         }
      }
      Int res = 0;
      for(Int i = 0; i < h; ++i) {
         for(Int k = 0; k < w; ++k) {
            Int x; scan(x);
            if( x == -1 ) continue;
            res += ds[x][1];
         }
      }
      printf("%ld\n", res);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




Measured memory_bytes: 256
/// sultanov

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type,
less<T>, rb_tree_tag, 
tree_order_statistics_node_update>;

using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string s;
    cin >> s;
    if (s == "SUN") 
        cout << 7;
    if (s == "MON")
        cout << 6;
    if (s == "TUE")
        cout << 5;
    if (s == "WED")
        cout << 4;
    if (s == "THU")
        cout << 3;
    if (s == "FRI")
        cout << 2;
    if (s == "SAT")
        cout << 1;
   

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static boolean[][] graph;
	static int n;
	static int[] a, b;
	static boolean[] visited;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		n = sc.nextInt();
		int m = sc.nextInt();

		graph = new boolean[n][n];
		a = new int[m];
		b = new int[m];
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt() - 1;
			b[i] = sc.nextInt() - 1;
			graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
		}

		int ans = 0;

		for (int i = 0; i < m; i++) {
			graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
			visited = new boolean[n];

			dfs(0);

			boolean bridge = false;
			for (int j = 0; j < n; j++) {
				if (!visited[j]) {
					bridge = true;
					break;
				}
			}
			if (bridge) {
				ans++;
			}
			graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
		}
		System.out.println(ans);

		sc.close();
	}

	static void dfs(int v) {
		visited[v] = true;
		for (int v2 = 0; v2 < n; v2++) {
			if (!graph[v][v2]) {
				continue;
			}
			if (visited[v2]) {
				continue;
			}
			dfs(v2);
		}
	}

}


Measured memory_bytes: 23892
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define INF 9223372036854775807
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0;
string s;
bool flag;
#pragma endregion
#define MAX 111111



int main(void) {
  vll a;
  cin >> n;
  FOR(i, 0, 3 * n) {
	cin >> tmp;
	a.pb(tmp);
  }
  sort(ALL(a));
  FOR(i, n, 3 * n) {
	if (i % 2 == n % 2) ans += a[i];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 5104
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

ll mpow(ll a, ll b){
	if(b==0){
		return 1;
	}else if(b%2==0){
		ll ret = mpow(a,b/2)%MOD;
		return ret*ret%MOD;
	}else{
		return mpow(a,b-1) * a %MOD;
	}
}

int main(void){
	string l;
	cin>>l;
	vector<ll> dp,dp2;
	rep(i,l.size()+10){
		dp.push_back(0);
		dp2.push_back(0);//girigiri
	}

	dp[0] = 1;
	dp2[0] = 2;
	reps(i,l.size()-1){
		if(l[i] == '1'){
			dp[i] += dp[i-1]*3 + dp2[i-1];
			dp2[i] += dp2[i-1] * 2;
		}else{
			dp[i] += dp[i-1] * 3;
			dp2[i] += dp2[i-1];
		}
		dp[i] %= MOD;
		dp2[i] %= MOD;
	}
	cout<<(dp[l.size()-1]+dp2[l.size()-1])%MOD<<endl;
	return 0;
}


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

#define INF INT_MAX
#define ll long long

using namespace std;

int main(){
	int A,B,K;
	cin >> A >> B >> K;
	int c = 0,ans;
	for(int i = A;i >= 1;i--){
		if(A % i == 0 && B % i == 0){
			c++;
			if(c == K){
				ans = i;
				break;
			}
		}
	}
	cout << ans << endl;

	return 0;
}


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

int main(){
  int N;
  cin >> N ;
  string S;
  cin >> S;
  int x = 0;
  int max = 0;
  for(int i = 0; i  < N;i++){
    if(S.at(i) == 'I'){x++;
    }else{x--;}
    if(x > max) max = x;
  }
  
  cout << max;
  return 0;
}


Measured memory_bytes: 256
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for _ in range(n):
    (b, f, r, v) = [int(i) for i in input().split()]
    data[b - 1][f - 1][r - 1] += v
 
for b in range(4):
    for f in range(3):
        for r in range(10):
            print('', data[b][f][r], end='')
        print()
    if b != 3:
        print('#' * 20)

Measured memory_bytes: 6720
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <utility>

using namespace std;
typedef long long signed int ll;

constexpr int inf = INT32_MAX / 4;

int n, m, r, p[8],d[200][200];

vector<vector<int>> all_comb(int n) {
	if (n == 1) return vector<vector<int>>({ vector<int>({ 0 }) });
	vector<vector<int>> ret;
	auto t = all_comb(n - 1);
	for (auto& e : t) {
		for (int i = 0; i < n; i++) {
			auto f = vector<int>(e);
			f.insert(f.begin() + i, n - 1);
			ret.push_back(f);
		}
	}
	return ret;
}

int main() {
	cin >> n >> m >> r;
	for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) d[i][j] = inf;
	for (int i = 0; i < r; i++) {
		cin >> p[i];
		p[i]--;
	}
	for (int i = 0; i < m; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		d[a-1][b-1] = d[b-1][a-1] = c;
	}
	for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) for (int k = 0; k < n; k++) {
		if (d[j][k] > d[j][i] + d[i][k]) d[j][k] = d[j][i] + d[i][k];
	}
	int res = inf;
	for (auto& e : all_comb(r)) {
		int s = 0;
		for (int i = 0; i < r - 1;i++) {
			s += d[p[e[i]]][p[e[i + 1]]];
		}
		res = min(res, s);
	}
	cout << res << endl;
}

Measured memory_bytes: 3896
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        int sum = 0;
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
            sum+= a[i];
        }

        int ans = Integer.MAX_VALUE;
        for (int i = 0; i <= N; i++) {
            int s1 = 0;
            for (int j = 0; j < i; j++) {
                s1 += a[j];
            }
            int s2 = sum - s1;
            ans = Math.min(ans, Math.abs(s1 - s2));
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define sc(x)            scanf("%d",&x)
#define scc(x)           scanf("%c",&x)
#define scl(x)           scanf("%lld",&x)
#define sz(v)	     	(v.size())
#define mem(v, d)		memset(v, d, sizeof(v))
#define oo				2000000100
#define OO				4000000000000000100
#define PI 3.14159265
#define S second
#define F first
#define Ceil(x,y) ((x+y-1)/y)
#define EPS 1e-10
typedef unsigned int uint;
typedef long long ll;


int dX[] = {0,0,1,-1};
int dY[] = {1,-1,0,0};
string alpha = "abcdefghijklmnopqrstuvwxyz";
int MOD = 1000000007;
const int N = 300100;


//-----------------------------------------------------
//ll GCD(ll num,ll ones) { return !ones ? num : GCD(ones,num%ones); }
//ll lcm(ll a, ll b) { return (a / GCD(a, b)) * b; }
//double Len(ll x,ll y,ll X,ll Y) { return sqrt((X-x)*(X-x)+(Y-y)*(Y-y)); }
/*ll fastP(ll b,ll p)
{
    if(p==0) return 1;
    else if(p==1) return b;
    ll a = fastP(b,p/2)%MOD;
    if(p%2) return (((a*a)%MOD)*b)%MOD;
    else return (a*a)%MOD;
}*/
//-----------------------------------
int n,m; bool vis[1005][1005];
string G[1005];
struct node{
    int x,y,l;
};
bool ok(int x,int y)
{
    return(x>=0&&x<n&&y>=0&&y<m&&!vis[x][y]);
}
int bfs()
{
    queue<node>q;
    for(int i = 0;i<n;++i)
        for(int j = 0;j<m;++j)
            if(G[i][j] == '#')
                q.push({i,j,0}),vis[i][j] = 1;
    int ret = 0;
    while(!q.empty())
    {
        node cur = q.front();
        q.pop();
        ret = max(ret,cur.l);
        for(int i = 0;i<4;++i)
        {
            int nx = cur.x + dX[i];
            int ny = cur.y + dY[i];
            if(ok(nx,ny))
                q.push({nx,ny,cur.l + 1}),vis[nx][ny] = 1;
        }
    }
    return ret;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("num.txt","w",stdout);
    sc(n); sc(m);
    for(int i =0;i<n;++i)
        cin>>G[i];
    cout << bfs() << endl;

    return 0;
}


Measured memory_bytes: 14352
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    string ans = "bust";

    if(a + b + c <= 21) {
        ans = "win";
    }

    cout << ans << endl;
}

Measured memory_bytes: 3572