akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

const int inf = 1e9 + 7;
int n, m;
vector<vector<int>> g;
int s, t;
vector<vector<int>> steps;

void bfs() {
    queue<pair<int, int>> q;
    q.emplace(s, 0);
    steps[s][0] = 0;
    while(!q.empty()) {
        pair<int, int> p = q.front(); q.pop();
        for (int e : g[p.first]) {
            int parity = (p.second + 1) % 3;
            int count = (p.second + 3) / 3;
            if (steps[e][parity] > count) {
                steps[e][parity] = count;
                q.emplace(e, p.second + 1);
            }
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    cin >> n >> m;
    g.resize(n);
    rep(i, m) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        g[u].emplace_back(v);
    }
    cin >> s >> t;
    s--; t--;
    steps.resize(n, vector<int>(3, inf));
    bfs();
    if (steps[t][0] == inf) cout << -1 << endl;
    else cout << steps[t][0] << endl;
    return 0;
}


Measured memory_bytes: 11264
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;





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

	vector<int> A(M);
	rep(i, M) cin >> A.at(i);

	int res = N;
	rep(i, M) {
		res -= A.at(i);
	}

	if (res < 0) cout << "-1" << endl;
	else cout << res << endl;
}

Measured memory_bytes: 3680
(let* ((n (read))
    (c (make-array n))
    (r 0)
    (ans 0))
    (loop for i below n do
        (progn
            (setf (aref c i) (read-char))
            (if (string= (aref c i) "R")
                (incf r)
            )
        )
    )
    (loop for i below r do
        (if (string= (aref c i) "W")
            (incf ans)
        )
    )
    (format t "~D~%" ans)
)

Measured memory_bytes: 38440
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int dp[1000000];
string S;
int main() {
	cin >> S; dp[0] = 1;
	for (int i = 0; i < S.size(); i++) {
		if (dp[i] == 0)continue;
		if (i + 5 <= S.size() && S.substr(i, 5) == "dream")dp[i + 5] = 1;
		if (i + 7 <= S.size() && S.substr(i, 7) == "dreamer")dp[i + 7] = 1;
		if (i + 5 <= S.size() && S.substr(i, 5) == "erase")dp[i + 5] = 1;
		if (i + 6 <= S.size() && S.substr(i, 6) == "eraser")dp[i + 6] = 1;
	}
	if (dp[S.size()] == 1)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define rloop(n, i) for(int i=n;i;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
const ll MOD = 998244353;
int main() {
    int n; cin >> n;
    string S; cin >> S;

    int pat[4][4][4] = {};
    pat[0][0][0] = n;

    ll ans = 1;
    loop (n * 3, i) {
        char c = S[i];
        int u = 0, v = 0, w = 0;
        if (c == 'R') u = 1;
        if (c == 'G') u = 2;
        if (c == 'B') u = 3;

        while (v == 0 || v == u) v++;
        while (w == 0 || w == u || w == v) w++;
        if (v > w) swap(v, w);

        if (pat[v][w][0] != 0) {
            ans = (ans * pat[v][w][0]) % MOD;
            pat[v][w][0]--;
            continue;
        }
        if (pat[v][0][0] != 0) {
            ans = (ans * pat[v][0][0]) % MOD;
            pat[v][0][0]--;
            int q1 = min(v, u), q2 = max(v, u);
            pat[q1][q2][0] += 1;
            continue;
        }
        if (pat[w][0][0] != 0) {
            ans = (ans * pat[w][0][0]) % MOD;
            pat[w][0][0]--;
            int q1 = min(w, u), q2 = max(w, u);
            pat[q1][q2][0] += 1;
            continue;
        }
        ans = (ans * pat[0][0][0]) % MOD;
        pat[0][0][0]--;
        pat[u][0][0] += 1;
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 900
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

char nome[120][120];

int ord(const void* x, const void* y){
        //const char *a = x, *b=y;
    return strcmp(x,y);
}

int ord_indice(const void* x, const void* y){
        const int *a = x, *b = y;
        return strcmp(nome[*a],nome[*b]);
}

int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    int indice[n];
    for(int i=0;i<n;i++){
        scanf("%s",nome[i]);
        indice[i]=i;
    }

    // ordenando as strings
    //qsort(nome,n,sizeof(nome[0]),ord);

    //ordenando o vetor de indices
    qsort(indice,n,sizeof(indice[0]),ord_indice);

    for(int i=0;i<n;i++)
        printf("%s",nome[indice[i]]);

    puts("");

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  string S;
  cin >> S;
  
  if(S[0] == 'A') {
    int cc = 0;
    int cci = 0;
    for(int i=2; i<=S.size()-2; i++) {
      if(S[i] == 'C') { cc++; cci = i; }
    }
    if(cc == 1) {
      for(int i=1; i<=S.size()-1; i++) {
        if(i == cci || (S[i] >= 'a' && S[i] <= 'z')) {
          
        } else {
          fin("WA");
          return 0;
        }
      }
      fin("AC");
      return 0;
    }
  }
  fin("WA");
  return 0;
}

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

int main()
{
	int N;
	cin >> N;
	cin >> a[0];
	P M = P(a[0],0), m = P(a[0],0);
	for (int i = 1; i < N; ++i)
	{
		cin >> a[i];
		if (a[i] > M.first) M = P(a[i],i);
		if (a[i] < m.first) m = P(a[i],i);
	}
	cout << 2*N - 2 << endl;
	if (abs(m.first) < abs(M.first))
	{
		rep(i,N)
		{
			if (i != M.second) cout << M.second+1 << " " << i+1 << endl;
		}
		rep(i,N-1)
		{
			cout << i+1 << " " << i+2 << endl;
		}
	}
	else
	{
		rep(i,N)
		{
			if (i != m.second) cout << m.second+1 << " " << i+1 << endl;
		}
		rep(i,N-1)
		{
			cout << N-i << " " << N-i-1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn rec(n: usize, buff: &mut Vec<i64>, mut ans: u32) -> u32 {
    //vec要素結合し数字に変換する
    let mut buff_num = 0;
    for (i, b) in buff.iter().enumerate() {
        buff_num += b * 10i64.pow((buff.len() - 1 - i) as u32);
    }
    //再帰終了条件
    if (buff_num as usize) > n {
        return ans;
    }

    //753数の判定
    if buff.contains(&3) && buff.contains(&5) && buff.contains(&7) {
        ans += 1;
    }

    //再帰全探索
    let v = vec![3, 5, 7];
    for num in v.into_iter() {
        buff.push(num);
        ans = rec(n, buff, ans);
        buff.pop();
    }

    ans
}

fn main() {
    let n: usize = read();
    let mut buff = Vec::new();
    let ans = rec(n, &mut buff, 0);
    print!("{}", ans);
}


Measured memory_bytes: 4352
#include <cstdio>
int exist[1001][1001][3]={};
char field[1001][1001];
int m,n,Q;
int main(){
	scanf("%d %d %d",&m,&n,&Q);
	for(int i=0;i<m;i++){
			scanf("%s",field[i]);
	}
	for(int i=0;i<m;i++){
		for(int j=i+1;j<=m;j++){
			if(field[i][0]=='J'){
				exist[j][1][0]++;
			}else if(field[i][0]=='O'){
				exist[j][1][1]++;
			}else{
				exist[j][1][2]++;
			}
		}
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<=n;j++){
			if(field[0][i]=='J'){
				exist[1][j][0]++;
			}else if(field[0][i]=='O'){
				exist[1][j][1]++;
			}else{
				exist[1][j][2]++;
			}
		}
	}
	if(field[0][0]=='J'){
		exist[1][1][0]=1;
	}else if(field[0][0]=='O'){
		exist[1][1][1]=1;
	}else{
		exist[1][1][2]=1;
	}
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			for(int k=0;k<3;k++){
			exist[i][j][k]=exist[i][j-1][k];
			}
			for(int k=0;k<i;k++){
				if(field[k][j-1]=='J'){
					exist[i][j][0]++;
				}else if(field[k][j-1]=='O'){
					exist[i][j][1]++;
				}else{
					exist[i][j][2]++;
				}
			}
		}
	}
	for(int i=0;i<Q;i++){
		int a,b,c,d;
		scanf("%d %d %d %d",&a,&b,&c,&d);
			int J=exist[c][d][0]-exist[c][b-1][0]-exist[a-1][d][0]+exist[a-1][b-1][0];
			int O=exist[c][d][1]-exist[c][b-1][1]-exist[a-1][d][1]+exist[a-1][b-1][1];
			printf("%d %d %d\n",J,O,(c-a+1)*(1+d-b)-J-O);
	}
	return 0;
}

Measured memory_bytes: 13612
import java.util.Scanner;

public class Main {

    private void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int X = sc.nextInt();
        int[] L = new int[N];
        for (int i = 0; i < N; i++) {
            L[i] = sc.nextInt();
        }

        int[] D = new int[N + 1];
        D[0] = 0;

        int count = 1;
        for (int i = 1; i <= N; i++) {
            D[i] = D[i - 1] + L[i - 1];
            if (D[i] <= X) {
                count++;
            }
            else {
                break;
            }
        }
        System.out.print(count);
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }

}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    int N;
    cin >> N;
    vector<int> H(N);
    rep(i, N)
    {
        cin >> H[i];
    }

    for (int i = N - 1; i >= 1; i--) {
        if (H[i] + 1 < H[i - 1]) {
            cout << "No" << endl;
            return 0;
        } else if (H[i] + 1 == H[i - 1]) {
            H[i - 1]--;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

typedef long long ll;

int main() {
    ll n;
    cin>>n;
    ll ans=0;
    for(int i=1;i<=n;++i) {
        ll t=n/i;
        ans+=i*(t*(t+1)/2);
    }
    cout<<ans;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT


signed main() {
  ll k, a, b;
  cin >> k >> a >> b;
  for (int i=a; i <= b; i++)
    if (i%k==0) {
      cout << "OK" << endl;
      return 0;
    }
  cout << "NG" << endl;
  return 0;
}


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

int main()
{
    std::string s;
    std::cin >> s;

    bool a = false;
    bool b = false;
    bool c = false;

    for(auto e : s){
        if (e == 'a'){a = true;}
        else if (e == 'b'){b = true;}
        else if (e == 'c'){c = true;}
    }

    if (a == false || b == false || c == false){
        std::cout << "No" << std::endl;
    } else {
        std::cout << "Yes" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int cou = 0;
        for(int i = 0 ; i<= n - 3 ; i++ ){
            if(s.charAt(i) == 'A' && s.charAt(i + 1) == 'B' && s.charAt(i + 2) == 'C'){
                cou++;
            }
        }
        System.out.println(cou);
        sc.close();
    }
}

Measured memory_bytes: 35544
import * as fs from 'fs'

const reader = (data: string) => data.split('\n')

function Main(input) {
  const [n, S] = reader(input)
  const N = parseInt(n, 10)
  const num = N / 2

  if (N % 2 !== 0) {
    console.log('No')
    return
  }

  for (let i = 0; i < num; i++) {
    if (S[i] !== S[i + num]) {
      console.log('No')
      return
    }
  }

  console.log('Yes')
}

Main(fs.readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin >> a >> b;
	cout << max(a*b, max(a + b, a - b)) <<endl; 
	return 0;
}

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

string getS(ll a){
  string res;
  while(a) res=(char)(a%10+'0')+res,a/=10;
  return res;
}

int main(){
  while(1){
    ll n,k;
    cin>>n>>k;
    if(!n&&!k) break;
    ll sum=0,d=1,c=9;
    while(sum+c*d<n){
      sum+=c*d;
      c*=10;
      d++;
    }
    
    ll num=(10*(c/10)/9)+(n-sum-(d!=1))/d;
    ll idx=(n-sum-(d!=1))%d;
    string ans,str=getS(num);
    for(int i=idx;i<str.size()&&ans.size()<k;i++)ans+=str[i];
    while(ans.size()<k){
      str=getS(++num);
      for(int i=0;i<str.size()&&ans.size()<k;i++)ans+=str[i];
    }
    cout <<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3236
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
int main(void)
{
long K, N, A[200000], index, maxdiff;
char S[7];

  scanf("%ld %ld", &K, &N);
  maxdiff = 0;
  for (index = 0; index < N; ++index) {
    scanf("%ld", &A[index]);
    if (index > 0) {
      maxdiff = MAX(A[index]-A[index - 1], maxdiff);
    }
    if (index == N - 1) {
      maxdiff = MAX(K - A[index] + A[0], maxdiff);
    }
  }
  printf("%ld\n", K - maxdiff);
  
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

int main()
{
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    a--;
    b--;
    c--;
    d--;

    string ans;
    if (c < d)
    {
        ans = "Yes";
        bool block = false;
        for (int i = a + 1; i < d; i++)
        {
            if (s[i] == '#')
            {
                if (block && (i < c || b < i))
                {
                    ans = "No";
                    break;
                }
                else
                {
                    block = true;
                }
            }
            else
            {
                block = false;
            }
        }
    }
    else
    {
        ans = "Yes";
        bool block = false;
        bool over = false;
        int cnt = 0;
        for (int i = a + 1; i < c; i++)
        {
            if (s[i] == '#')
            {
                if (block)
                {
                    ans = "No";
                    break;
                }
                else
                {
                    block = true;
                }
            }
            else
            {
                block = false;
            }

            if (b - 1 <= i && i <= d + 1)
            {
                if (s[i] == '#')
                {
                    cnt = 0;
                }
                else
                {
                    cnt++;
                    if (cnt == 3)
                    {
                        over = true;
                    }
                }
            }
        }
        if (!over)
        {
            ans = "No";
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
k,n=map(int, input().split())

a=list(map(int, input().split()))

amax=k-a[n-1]+a[0]
for i in range(n-1):
    ai=a[i+1]-a[i]
    amax=max(ai,amax)
#    print(ai,amax)

print(k-amax)
    

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

using namespace std;

bool isSquare(int n) {
    auto tmp = (int) sqrt(n);
    return tmp * tmp == n;
}

int main() {
    int n, d;
    cin >> n >> d;

    int x[10][10] = {};
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < d; ++j) {
            cin >> x[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < n - 1; ++i) {
        for (int j = i + 1; j < n; ++j) {
            int dist = 0;
            for (int k = 0; k < d; ++k) {
                dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            if (isSquare(dist)) ans++;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(c) c.begin(), c.end()
#define rep(i,a,b) for(int i = a;i < b; ++i)
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
using namespace std;

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

const int N = 1e5 + 5;
int cnt[N];
bool done[N];

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n,m;
	cin >> n >> m;
	int p;
	string s;
	int solved = 0, penalty = 0;
	while(m--){
		cin >> p >> s;
		if(!done[p]){
			if(s == "AC"){
				done[p] = 1;	
				++solved;
				penalty+=cnt[p];
			}
			else{
				++cnt[p];
			}
		}
	}
	cout << solved << ' ' << penalty << '\n';
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, char> P;
typedef long long ll;
const int INF = 114514810;
const ll MOD = 1000000007;
const double EPS = 1e-8;
const double PI = acos(-1.0);
struct edge
{
	int to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};

vector<vi> s, h;
int n, m;
double dp[222][222];

double solve(int i, int w)
{
	if (i == n) return 0;
	if (dp[i][w] >= 0) return dp[i][w];
	double res = -1;
	int tmp = 0, full = s[i][0] * h[i][0];
	double tmph = 0;
	res = max(res, solve(i + 1, w));
	FOR(j, 1, w+1)
	{
		if (j > full)
		{
			tmp++;
			if (tmp == s[i].size()) break;
			full += s[i][tmp] * h[i][tmp];
		}
		tmph += 1.0 / s[i][tmp];
		res = max(res, solve(i + 1, w - j) + tmph);
	}
	return dp[i][w] = res;
}

int main()
{
	MS(dp, -1);
	cin >> n >> m;
	s.resize(n), h.resize(n);
	REP(i, n)
	{
		int k; cin >> k;
		s[i].resize(k), h[i].resize(k);
		REP(j, k) cin >> s[i][j] >> h[i][j];
	}
	cout << D10 << solve(0, m) << endl;
	return 0;
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using LL = long long;
#define REP(i, n) for (LL i = 0; i < (LL)(n); i++)
#define REP2(i, n) for (LL i = 1; i <= (LL)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0)
#define vLL(v,n) vector<LL> v(n); REP(i,n)cin>>v[i];
#define vstr(v,n) vector<string> v(n); REP(i,n)REP(i,n)cin>>v[i];
LL INF = 1e9 + 1;
LL MOD = 1e9+7;
  LL a,b,c,d,e,n,m,l,k,r,x,y,z,ans=0,ans2=0;
string s,S,t;
int main() {
  int k;
  cin >> k;
  REP(i, k)
      cout << "ACL";
}

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


using namespace std;

int main()
{
	int N,M;
	int T[101];
	int P[101];
	int X[101];
	long long time;
	cin >> N;
	for (int i = 1; i < N+1; ++i) cin >> T[i];
	cin >> M;
	for (int j = 1; j < M+1; ++j) cin >> P[j] >> X[j];

	for (int k = 1; k < M + 1; ++k) {
		time = 0;
		for (int l = 1; l < N + 1; ++l) {
			if (l == P[k]) {
				time = time + X[k];
			}else{
			time = time + T[l];
			}
		}

		cout << time << endl;
	}

	return 0;
}

Measured memory_bytes: 256
num = int(input())

count = {"AC":0,"WA":0,"TLE":0,"RE":0}

for _ in range(num):
    s = input()
    count[s] += 1

print("AC x {}".format(count["AC"]))
print("WA x {}".format(count["WA"]))
print("TLE x {}".format(count["TLE"]))
print("RE x {}".format(count["RE"]))


Measured memory_bytes: 9212
color = input().split() #s_1 s_2を分割して取得し、colorに値を入れる
count = list(map(int, input().split())) #i_1 i_2を取得し、countに値を入れる
select_color = input() # 玉の色を選択

for i in range(0, 2):
    if select_color == color[i]:
        count[i] -= 1
print(count[0], count[1]) #残りの個数を出力

Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main() {
	int n;

	cin >> n;

	bool can = false;

	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			if (n == i * j) can = true;
		}
	}

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

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int o=0,l=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='0')o++;
        else l++;
    }
    cout<<2*min(o,l)<<endl;
    return 0;
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main{
	static int hei[];
	public static void main(String args[]){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			while(true){
				String strs[] = br.readLine().split(" ");
				int w = Integer.parseInt(strs[0]);
				int q = Integer.parseInt(strs[1]);
				if(w == 0 && q == 0) return;
				hei = new int[w];
				for(int i = 0; i < w; i++){
					hei[i] = -1;
				}
				
				for(int i = 0; i < q; i++){
					strs = br.readLine().split(" ");
					char method = strs[0].charAt(0);
					switch(method){
					case 's':{
						int id = Integer.parseInt(strs[1]);
						int cat_w = Integer.parseInt(strs[2]);
						sleep(id, cat_w);
						break;
					}
					case 'w':{
						int id = Integer.parseInt(strs[1]);
						wakeup(id);
						break;
					}
					}
				}
				System.out.println("END");
			}
		} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
		}
	}
	
	public static void sleep(int id, int cat_w){
		int space = 0;
		int point = 0;
		for(int i = 0; i < hei.length; i++){
			if(hei[i] == -1){
				if(space == 0) point = i;
				space++;
				if(space >= cat_w){
					System.out.println(point);
					for(int j = 0; j < space; j++){
						hei[point + j] = id;
					}
					return;
				}
			}else{
				space = 0;
			}
		}
		System.out.println("impossible");
	}
	
	public static void wakeup(int id){
		int point = 0;
		for(int i = 0; i < hei.length; i++){
			if(hei[i] == id){
				point = i;
				break;
			}
		}
		for(int i = point; i < hei.length; i++){
			if(hei[i] != id) break;
			hei[i] = -1;
		}
	}
}

Measured memory_bytes: 18224
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

ll mod=1e9+7;

ll modpow(ll a, ll p) {
  ll ret=1;
  while(p>0) {
    if(p&1) ret=(ret*a)%mod;
    a=(a*a)%mod;
    p>>=1;
  }
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,d,n,ans=1,zero_w=0;cin>>n;
  map<P,P> mp;
  rep(i,n) {
    cin>>a>>b;
    if(a==0&&b==0) {zero_w++;continue;}
    d=__gcd(a,b);
    a/=d,b/=d;
    if(b<0) a=-a,b=-b;
    if(b==0&&a<0) a=-a,b=-b;
    if(a<=0) {
      ll a_=a;
      a=b;b=-a_;
      mp[P(a,b)].first++;
    }
    else mp[P(a,b)].second++;
  }
  for(auto p:mp) {
    a=p.second.first;
    b=p.second.second;
    ll ans_=1;
    ans_+=modpow(2,a)-1;
    ans_+=modpow(2,b)-1;
    ans_%=mod;
    ans*=ans_;
    ans%=mod;
  }
  ans-=1;
  ans+=zero_w;
  ans%=mod;
  while(ans<0) ans+=mod;
  print(ans);
  return 0;
}

Measured memory_bytes: 19216
#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
#define per(i,n) for ((i)=n;(i)>=(1);(i)--)
using namespace std;
int n,m,px[1000005],py[100005],gg[100005],ans;
bitset<405> f[405];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);rep(i,m)scanf("%d%d",&px[i],&py[i]);
	rep(i,n)
	{
		f[i][i]=1;
		per(j,m)
		{
			if(f[i][px[j]]&&f[i][py[j]]){gg[i]=1;break;}
			if(f[i][px[j]]) f[i][py[j]]=1;
			else if(f[i][py[j]]) f[i][px[j]]=1;
		}
	}
	rep(i,n)if(!gg[i])rep(j,n)if(i<j&&!gg[j])
	{
		if(!(f[i]&f[j]).count()) ans++;
	}
	printf("%d\n",ans);
	return 0;
}

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

int main(){
	int n,K;cin>>n>>K;
	int cnt=1,i=1;
	for(;;i++){
		int need=(cnt+K-1)/K;
		if(cnt+need>n)break;
		cnt+=need;
	}
	cout<<i<<endl;
}


Measured memory_bytes: 3092
N = int(input())
*A, = map(int, input().split())
def heapify(i):
    l = 2*i+1; r = 2*i+2
    left = l < N and A[i] < A[l]
    right = r < N and A[i] < A[r]
    if left and right:
        if A[l] < A[r]:
            left = 0
        else:
            right = 0
    if left:
        A[i], A[l] = A[l], A[i]
        heapify(l)
    elif right:
        A[i], A[r] = A[r], A[i]
        heapify(r)


for i in range(N-1, -1, -1):
    heapify(i)
print("",*A)



Measured memory_bytes: 63700
//14:39
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
 
using namespace std;
 
#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define mp make_pair
#define pb pushback
#define gdmax 300000
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vp;
 
typedef long long ll;
 
vi gdset;
 
void makegdset(){
    REP(i,2,gdmax){
        if(i%7==1 || i%7==6){
            bool f=true;
            rep(j,gdset.size()){
                if(i%gdset[j]==0){
                    f=false;
                    break;
                }
            }
            if(f){
                gdset.push_back(i);
            }
        }
    }
}
vi makegdps(int prime){
    vi xx;
    rep(i,gdset.size()){
        int tprime = prime;
        if(tprime%gdset[i]==0){
            xx.push_back(gdset[i]);
        }
    }
    return xx;
}
int main() {
    makegdset();
    // cout << "debug:" << gdset.size();
    // rep(i,gdset.size()){
    //     cout << " " <<gdset[i];
    // }
    // cout <<endl;
    // return 0;
    while(1){
        int x;
        cin >> x;
        if(x==1){
            break;
        }
        vi xx = makegdps(x);
        if(xx.size()==0){
            xx.push_back(x);
        }
        cout << x << ":";
        rep(i,xx.size()){
            cout << " " << xx[i];
        }
        cout <<endl;
    }
    return 0;
}

Measured memory_bytes: 3140
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<climits>

using namespace std;

const int N=1e5+50;

int A,B,M,a[N],b[N],c[N],mina=INT_MAX,minb=INT_MAX;

int main()
{
	ios::sync_with_stdio(false);
	
	cin>>A>>B>>M;
	
	for (int i=1;i<=A;i++) cin>>a[i],mina=min(mina,a[i]);
	for (int i=1;i<=B;i++) cin>>b[i],minb=min(minb,b[i]);
	
	int ans=mina+minb;
	
	for (int i=1;i<=M;i++)
	{
		int x,y,z;
		cin>>x>>y>>z;
		
		ans=min(ans,a[x]+b[y]-z);
	}
	printf("%d\n",ans);
} 

Measured memory_bytes: 1024
s=list(input())
if (s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]) or (s[0]==s[2] and s[1]==s[3] and s[0]!=s[1]) or (s[0]==s[3] and s[1]==s[2] and s[0]!=s[1]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }
#define ll long long

const long long mod = 1e+9 + 7; 

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}



void test_case(){
    long long n;
    cin >> n;
    long long res = 1;
    res = n;
    //res *= (n-1);
    //res %= mod;
    
    long long ans1 = binpow(10, n, mod);
    long long ans2 = binpow(8, n, mod);
    long long ans3 = binpow(9, n, mod);
    
    res = (ans1 + ans2 -(long long)2*ans3 + 10*mod)%mod;
    
    
    cout << res << endl;
} 


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


 


Measured memory_bytes: 3608
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n;i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;

  int main(){
    int n;cin>>n;
    string s,t;cin>>s>>t;
    string p;
    for(int i=0;i<n;i++)
    {
      p+=s.at(i);
      p+=t.at(i);
    }
    cout<<p;
  }
      
    
  

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int R = sc.nextInt();
        
        if(N<10){
            int X = 100*(10-N);
            System.out.println(R+X);
        }else{
            System.out.println(R);
        }
    }
}


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

using namespace std;

int n, k;
vector<int> v;
int dp[100001];

bool util(int k){
    if(k<=0)
        return false;
    if(dp[k]!=-1)
        return dp[k];
    for(int i=0; i<n; i++)
        if(v[i]<=k && !util(k-v[i]))
            return dp[k]=true;
    return dp[k]=false;
}

int main()
{
    memset(dp, -1, sizeof(dp));
    cin >> n >> k;
    v=vector<int>(n);
    for(int i=0; i<n; i++)
        cin >> v[i];
    if(util(k))
        cout << "First" << endl;
    else
        cout << "Second" << endl;
	return 0;
}


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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  set<int> sheet;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    if (sheet.count(a)) sheet.erase(a);
    else sheet.insert(a);
  }
  printf("%d\n", (int)sheet.size());
  return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
#include <string.h>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15

int main(){

 long long n;
 cin>>n;

 int a[n];

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


  int maxi= a[0],cnt=1;

  for(int i=1;i<n;i++){

     if(a[i] >= maxi){
     //   cout<<a[i]<<" "<<i<<endl;
      cnt++;
      maxi = a[i]; }
  }

  cout<<cnt<<endl;

  return 0;
}



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

int main() {
  double W;
  double H;
  double x;
  double y;
  cin >> W >> H >> x >> y;
  if ( W == x*2 && H == y*2){
    cout<<std::setprecision(12)<< (W*H)/2 << endl;
    cout<< 1 << endl;
  }
  else{
    cout<<std::setprecision(12)<< (W*H)/2 << endl;
    cout << 0 <<endl;
  }

}

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

int res = 0;
int n;
// num := 現時点で消した数。
// state := その時の状態をビットで表したもの
void dfs(int num, int state, vector<vector<int>> &G, vector<int> in, vector<int> &c, vector<bool> &used) {
    if (used[state]) return;
    used[state] = true;

    for (int i = 0; i < n; ++i) {
        if ((state >> i) & 1) continue;
        for (int j = i + 1; j < n; ++j) {
            if ((state >> j) & 1) continue;

            if (in[i] == 0 && in[j] == 0 && c[i] == c[j]) {
                int nstate = state;
                nstate |= 1 << i;
                nstate |= 1 << j;
                for (int to : G[i]) {
                    --in[to];
                }
                for (int to : G[j]) {
                    --in[to];
                }
                dfs(num + 2, nstate, G, in, c, used);
                for (int to : G[i]) {
                    ++in[to];
                }
                for (int to : G[j]) {
                    ++in[to];
                }
            }
        }
    }
    res = max(res, num);
}

int main() {
    while (true) {
        cin >> n;
        if (n == 0) break;

        // DAG
        vector<vector<int>> G(n);
        // 入次数
        vector<int> in(n);
        // 入力
        vector<int> x(n), y(n), r(n), c(n);
        for (int i = 0; i < n; ++i) {
            cin >> x[i] >> y[i] >> r[i] >> c[i];
        }
        for (int i = 0; i < n; ++i) {
            for (int j = i + 1; j < n; ++j) {
                // i番目とj番目の円が重なるなら、i->jに向けた辺を張る
                int dx = x[i] - x[j];
                int dy = y[i] - y[j];
                int R = r[i] + r[j];
                if (dx * dx + dy * dy < R * R) {
                    G[i].push_back(j);
                    ++in[j];
                }
            }
        }

        // どの円盤を消したかの情報をビットで表し、その状態ビットに遷移したことがあるかどうか記録
        vector<bool> used((1 << n), false);
        res = 0;
        dfs(0, 0, G, in, c, used);
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vi a(n); for (int i = 0; i < n; i++) cin >> a[i];
    bool flag = true;
    int cnt = 0;
    while (flag) {
        flag = false;
        for (int i = n - 1; i > 0; i--) {
            if (a[i] < a[i - 1]) {
                swap(a[i], a[i - 1]);
                flag = true;
                cnt++;
            }
        }
    }
    cout << a[0];
    for (int i = 1; i < n; i++) cout << " " << a[i];
    cout << endl;
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3168
#include <iostream>
#include <cmath>

int main()
{
    int s, e, sum{};
    std::cin >> s >> e;
    for (auto i = s; i <= e; ++i)
    {
        const auto digits{std::to_string(i)};
        const int half_length = digits.length() / 2;
        const auto itsf = digits.begin();
        const auto itsr = digits.rbegin();
        const bool is_palindromic_number{std::string(itsf, itsf + half_length) == std::string(itsr, itsr + half_length)};
        sum += is_palindromic_number ? 1 : 0;
    }
    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
cnt = 0
ans = ''
st = list()
for x in a:
    while cnt < x:
        ans += '('
        cnt += 1
        st.append(cnt)
    if st[-1] == x:
        st.pop()
        ans += ')'
    else:
        ans = ':('
        break
print(ans)


Measured memory_bytes: 16452
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

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

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

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

int main() {
  int N;
  cin >> N;
  bool f = false;
  while(N) {
    int m = N % 10;
    if(m == 7) f =true;
    N/=10;
  }
  cans(f);
}















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

struct TXY{
    int t;
    int x;
    int y;
};

int distance(const struct TXY& lhs, const struct TXY& rhs){
    int dx = abs(lhs.x - rhs.x);
    int dy = abs(lhs.y - rhs.y);
    return dx + dy;
}

int main(){
    int N; cin >> N; N++;
    vector<struct TXY> vecTxy(N);
    vecTxy[0].t = 0;
    vecTxy[0].x = 0;
    vecTxy[0].y = 0;
    for(int i=1; i<vecTxy.size(); ++i){
        cin >> vecTxy[i].t;
        cin >> vecTxy[i].x;
        cin >> vecTxy[i].y;
    }
    
    for(int i=1; i<vecTxy.size(); ++i){
        int t = vecTxy[i].t - vecTxy[i-1].t;
        int d = distance(vecTxy[i-1], vecTxy[i]);
//        if(t%d!=0){
        if((t+d)&1 || t<d){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n;cin>>n;
   string s;
  cin>>s;
  int c=0;
  for(int i=0;i<=n-3;i++){
    if(s[i]=='A'){
      string p=s.substr(i,3);
      if(p=="ABC")c++;
    }
  }
  cout<<c<<endl;
}


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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define yes() cout << "Yes"<< endl;
#define no() cout << "No"<< endl;

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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			String S = in.next();
			char[] array = S.toCharArray();
			Arrays.sort(array);
			String ans = "yes";
			for(int i = 1; i < array.length; i++) {
				if(array[i] == array[i - 1]) {
					ans = "no";
					break;
				}
			}
			out.println(ans);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

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

	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=998244353;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

int main(){
    ll n,s;cin>>n>>s;
    vi v(n);
    rep(i,n)cin>>v[i];
    vi dp(s+1);
    ll k=modpow(2,mod-2);
    dp[0]=modpow(2,n);
    rep(i,n){
        vi ndp=dp;
        rep(j,s+1){
            if(j+v[i]>s)break;
            ndp[j+v[i]]+=k*dp[j]%mod;
            ndp[j+v[i]]%=mod;
        }
        dp=ndp;
    }
    out(dp[s]);
}

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
int main()
{
    string S, T;
    cin >> S >> T;
    int min = T.length();
    for (int i = 0; i <= S.length() - T.length(); i++)
    {

        int cnt = 0;
        for (int j = 0; j < T.length(); j++)
        {
            if (S[i + j] != T[j])
            {
                cnt++;
                //cout << S[i + j] << T[j] << cnt << endl;
            }
        }
        if (cnt < min)
            min = cnt;
    }
    cout << min;

    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define mp make_pair
using namespace std;

using ll = long long;
using ii = pair<int, int>;
const int INF = (int)10e9;
int N, K;
vector<int> v;
vector<int> dp;

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> N >> K;
    v.resize(N);
    dp.resize(N);
    fill(all(dp), 0);

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

    for(int i = 1; i < N; i++) 
    {
        dp[i] = INF;
        for(int j = 1; j <= K; j++) 
        {
            if(i - j >= 0) 
            {
                dp[i] = min(dp[i], abs(v[i] - v[i-j]) + dp[i-j]);
            }
        }
    }

    cout << dp[N-1] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long a, b;
    cin >> a >> b;
    if (a * b <= 0)
        cout << "Zero" << endl;
    else
    {
        if (a > 0 && b > 0)
            cout << "Positive" << endl;
        if (a < 0 && b < 0)
        {
            if ((b - a + 1) % 2 == 1)
                cout << "Negative" << endl;
            else
                cout << "Positive" << endl;
        }
    }
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b;
    rep(i,n){
        cin >> a[i];
        b.pb(a[i]);
    }
    sort(b.begin(), b.end(), greater<int>());
    int max = b[0];
    rep(i,n){
        if(max == a[i]) cout << b[1] << endl;
        else cout << b[0] << endl;
    }
}

Measured memory_bytes: 3316