akhauriyash/Code-Regression huggingface dataset:
//template code, C343, 2019
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	public void printAdjMatrix() {
		Integer[][] adjMatrix = new Integer[totalVertex][totalVertex];
		for(int i = 0; i < totalVertex; i++) {
			for(int j = 0; j < totalVertex; j++) {
				if(adjList.get(i).contains(j)) {
					adjMatrix[i][j] = 1;
				}
				else {
					adjMatrix[i][j] = 0;
				}
				if(j == totalVertex - 1){
				    System.out.print(adjMatrix[i][j]);
				}
				else{
				    System.out.print(adjMatrix[i][j] + " ");
				}
				
			}
			System.out.print("\n");
		}
		
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.printAdjMatrix();
	}
}


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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

void solve(){
    LL n, a, b, c;
    cin >> n;
    vi dp(3);
    for(int i = 0; i < 3; ++i) cin >> dp[i];

    for(int i = 1; i < n; ++i){
        cin >> a >> b >> c;
        vi prev = dp;
        dp[0] = max({prev[0], prev[1]+a, prev[2]+a});
        dp[1] = max({prev[1], prev[0]+b, prev[2]+b});
        dp[2] = max({prev[2], prev[0]+c, prev[1]+c});
    }

    cout << max({dp[0], dp[1], dp[2]}) << "\n";
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int A, B; cin >> A >> B;
    for (int i = 1; i <= 10000; i++) {
        if (i * 8 / 100 == A && i * 10 / 100 == B) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }

const int mod=1e9+7;
const int INF=1001001001;

int main() {
  double N,K;
  cin>>N>>K;
  double ans=0;
  for(int i=1;i<=N;i++){
    int x=i;
    double p=1;
    int cnt=0;
    while(x<K){
        cnt++;
        x*=2;
        p/=2;
    }
    ans+=(1/N)*p;
  }
  cout<<fixed<<setprecision(15)<<ans<<endl;
  return 0;  
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k=0;
    int N;
    cin >> N;
    int inp;
    for(int i=1; i<=N; i++){
        cin >> inp;
        if(inp!=i) k++;
    }
    if(k>2) cout << "NO";
    else cout << "YES";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m;
  cin>>n>>m;
  vector<pll> p(m);
  rep(i,m){
    ll a,b;
    cin>>a>>b;
    p[i]=mp(b,a);
  }
  sort(all(p));
  ll k=p[0].F;
  ll ans=1;
  for(int i=1;i<m;i++){
    if(k<=p[i].S){
      ans++;
      k=p[i].F;
    }
  }COUT(ans);
}


Measured memory_bytes: 1792
#                         author:  kagemeka 
#                         created: 2019-11-08 13:38:56(JST)
## internal modules
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external modules
# import scipy.special   # if use comb function on AtCoder, 
# import scipy.misc      # select scipy.misc.comb (old version) 

def main():
    s = sys.stdin.readline().rstrip()
    ans = s.count('+') - s.count('-')
    print(ans)
    



if __name__ == "__main__":
    # execute only if run as a script
    main()


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(v) sort(all(v)),v.erase(unique(all(v)),v.end())
typedef long long LL;
typedef pair <int,int> pii;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 1e5 + 5;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif // LOCAL
  string s;
  cin >> s;
  bool f = false;
  for (int i = 0; i < s.size(); i++) if (s[i] == '7') f = true;
  cout << (f ? "Yes" : "No") << endl;
  return 0;
}



Measured memory_bytes: 3648
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

L,R,d = map(int,readline().split())
ans = 0
for i in range(L,R+1):
    if i%d == 0:
        ans += 1
print(ans)


Measured memory_bytes: 9380
/**
 * Title: D - Powerful Discount Tickets
 * Url: https://atcoder.jp/contests/abc141/tasks/abc141_d
 */
#include<bits/stdc++.h>
 
using namespace std;
 
#define ll long long
 
int main() {
 
    int n, m; cin >> n >> m;
    vector<ll> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
 
    // 前処理
    int max_h = 0;
    for(int i=0; i<n; i++) {
        int x = (int)log2(a[i]);
        max_h = max(max_h, x);
    }
 
    sort(a.begin(), a.end(), greater<int>());
    for(int i=max_h; i>=0; i--) {
        // N
        for(int j=0; j<n; j++) {
            if((int)log2(a[j])==i) {
                a[j] /= 2;
                m--;
            }
            if(m==0) break;
        }
        // NlogN
        sort(a.begin(), a.end(), greater<int>());
        if(m==0) break;
    }
 
    if(m>0) {
        cout << 0 << endl;
    } else {
        ll ans = 0;
        for(int i=0; i<n; i++) {
            ans += a[i];
        }
        cout << ans << endl;
    }
 
 
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
#define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0) (__VA_ARGS__)
#define rep_0(i, end) for (int i = 0; i < (end); ++i)
#define rep_1(i, fr, ba) for (int i = (fr); i <= (ba); ++i)
#define overload_rep(arg_0, arg_1, arg_2, name, ...) name
#define all(box) box.begin(), box.end()
 
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }

int main() {

  int k, x;
  std::cin >> k >> x;
  puts(k * 500 >= x ? "Yes" : "No");

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();

        int ans = t.length;
        for (int i = 0; i <= s.length - t.length; i++) {
            int tmp = 0;
            for (int j = 0; j < t.length; j++) {
                if (s[i+j] != t[j])
                    tmp++;
            }
            ans = Math.min(tmp, ans);

            if (ans == 0)
                break;
        }

        System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

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

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 32724
import java.util.Scanner;

public class Main {
    private static Scanner scanner = new Scanner(System.in);
    private static int n;
    private static float[] x;
    private static String[] u;

    private static final float btc = 380000.0f;

    public static void main(String[] args) {
        init();

        float sum = 0.0f;

        for (int i = 0; i < n; i++) {
            x[i] = scanner.nextFloat();
            u[i] = scanner.next();

            if (u[i].equals("JPY")) {
                sum += x[i];
            } else if (u[i].equals("BTC")) {
                sum += (x[i] * btc);
            }
        }

        System.out.println(sum);
    }

    public static void init() {
        n = scanner.nextInt();
        x = new float[n];
        u = new String[n];
    }
}

Measured memory_bytes: 23252
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}
#ifdef LOCAL
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

long long GCD(long long a, long long b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll N;
    cin >> N;
    vector<pair<ll, ll>> BA(N + 1); //0番目は使わない.ソートするためにBAの順で持つ。
    FOR(i, 1, N + 1) { cin >> BA[i].second >> BA[i].first; }
    debug(BA);
    sort(BA.begin(), BA.end());
    debug(BA);
    ll current = 0;
    FOR(i, 1, N+1){
        current += BA[i].second;
        if(current > BA[i].first){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3456
n,x,y = map(int,input().split())
x -= 1
y -= 1
a = [0] * n
for i in range(n-1):
    for j in range(i+1,n):
        m = min(j-i,abs(i-x)+1+abs(j-y))
        a[m] += 1
for i in range(1,n):
    print(a[i])


Measured memory_bytes: 3572
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int P=1e9+7;
char st[300005];
int f[300005][8],ch[8][2]; 
void build()
{
	ch[0][0]=2; ch[0][1]=1; 
	ch[1][0]=3; ch[1][1]=5; 
	ch[2][0]=4; ch[2][1]=7; 
	ch[3][0]=6; ch[3][1]=1;
	ch[4][0]=2; ch[4][1]=2; 
	ch[5][0]=5; ch[5][1]=5;
	ch[6][0]=3; ch[6][1]=3; 
	ch[7][0]=2; ch[7][1]=1; 
}
int main()
{
	build();
	scanf("%s",st+1);
	int n=strlen(st+1);
	f[n][1]=f[n][5]=1; 
	for (int i=n-1; i>=0; i--)
		for (int j=0; j<=7; j++)
		{
			if (st[i+1]!='1') f[i][j]+=f[i+1][ch[j][0]];
			if (st[i+1]!='0') f[i][j]+=f[i+1][ch[j][1]];
			if (f[i][j]>=P) f[i][j]-=P;
		}
	printf("%d\n",f[0][0]);
	return 0;
}


Measured memory_bytes: 9856
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define f(ii,n) for(ii=0;ii<n;ii++)
#define F(ii,a,n) for(ii=a;ii<n;ii++)
#define read(array,n) for(ll i=0;i<n;i++) cin>>array[i];
#define inf 1000000007;
// function to transform string to lowercase --> transform(s.begin(),s.end(),s.begin(),::tolower)
void swap(ll *xp,ll *yp){
	ll temp = *xp;
	*xp = *yp;
	*yp = temp;
}

ll power(ll i,ll j){
	ll prod=1;
	while(j>0){
		if(j&1){
			prod=prod*i;
		}
		j=j>>1;
		i=i*i;
	}
	return prod;
}

void solve(){
	ll i,j,a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1){
		c=c-b;
		if(c<=0){
			cout<<"Yes\n";
			return;
		}
		a=a-d;
		if(a<=0){
			cout<<"No\n";
			return;
		}
	}
}
int main(){
	// freopen("filename.txt","r",stdin);
	solve();
	
	// ll t;
	// cin>>t;
	// while(t--){
	// 	solve();
	// }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define trace(it,mp) for(auto it = (mp).begin(); it != (mp).end(); it++)
#define f4(i,n) for(ll i=0;i<n;i++)
#define mod 1000000000
#define f first
#define s second
using namespace std;

// covert number to string to_string(x);
void knapsack(ll n,ll k,ll w[],ll v[])
{
	ll beg[n+1][k+1];

	for(ll i=0;i<=n;i++)
	{
		for(ll ww=0;ww<=k;ww++)
		{
			if(i==0 || w==0)
				beg[i][ww]=0;
			else
			{
				if(w[i-1]<=ww)
					beg[i][ww]=max(v[i-1]+beg[i-1][ww-w[i-1]],beg[i-1][ww]);
				else
					beg[i][ww]=beg[i-1][ww];
			}
		}
	}

	cout << beg[n][k];
}

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

    ll t,a,b,c,x,y,z,n,m,k,ans=0;
    cin >> n >> k;

    ll w[n],v[n];

    f4(i,n)
    {
    	cin >> w[i] >> v[i];
    }

    knapsack(n,k,w,v);

    cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
}

Measured memory_bytes: 79232
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        if (A == 2 || B == 2) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
        sc.close();
    }
}

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

int main()
{
	int N;
  	vector<long long> V(N);
  	long long B_sum = 0;
  	cin >> N;
  	for(int i = 0; i < N; i++){
      	long long a, b;
    	cin >> a;
      	cin >> b;
      	V.push_back(a+b);
      	B_sum += b;
    }
  	sort(V.begin(), V.end());
  	reverse(V.begin(), V.end());
	long long sum = 0;
  	int count = 0;
  	if(N%2)
      count = N/2 + 1;
	else
      count = N/2;
  	for(int i = 0; i < count; i++){
    	sum += V[2*i];
    }
  	cout << sum - B_sum << endl;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  for(int i=0;i<=n;i+=4){
    if((n-i)%7==0){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define vi vector <int>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	ll n; cin>>n;
	n = n%1000;
	if(n>0) n = 1000-n;
	cout<<n;

	return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

vector<vector<int>> edges;
vector<int> colors; // 0: unassigned, 1: black, 2: white, 3: both

void assign_colors(const int cur, const int col, const int N, const int M) {
    if (colors[cur] & col) {
        return;
    }

    colors[cur] |= col;

    for (auto next_v : edges[cur]) {
        int next_col = 3 - col;
        assign_colors(next_v, next_col, N, M);
    }
}

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

    edges.resize(N);
    for (int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        A--;
        B--;
        edges[A].push_back(B);
        edges[B].push_back(A);
    }

    colors.resize(N, 0);
    assign_colors(0, 1, N, M);

    int black_count = 0, white_count = 0;
    bool both_color_exists = false;
    for (int i = 0; i < N; i++) {
        assert(colors[i] != 0);
        if (colors[i] == 1) black_count++;
        else if (colors[i] == 2) white_count++;
        else if (colors[i] == 3) both_color_exists = true;
    }

    ll ans = 0;
    if (both_color_exists) {
        ans = ((ll) N) * ((ll) (N - 1)) / 2 - ((ll) M);
    } else {
        for (int i = 0; i < N; i++) {
            if (colors[i] == 1) {
                ans += white_count - ((int) edges[i].size());
            } else if (colors[i] == 2) {
                ans += black_count - ((int) edges[i].size());
            }
        }
        assert(ans % 2 == 0);
        ans /= 2;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1 << 29;
const int MOD = 1000000007;

/*
int main() {
    int n;
    string s;
    cin >> n >> s;

    int red = 0, green = 0, blue = 0;
    for (auto color : s) {
        if (color == 'R') red++;
        if (color == 'G') green++;
        if (color == 'B') blue++;
    }

    // 1つ目の条件を満たす組の数はr*g*bで求められる
    long long condition1 = red * green * blue;

    // ２つ目の条件を満たさないものを求め、それを1つ目の中から引く
    // 判定を簡単にするためにr = 1; g = 2, b = 4と置き換えておく
    rep(i, n) {
        if (s[i] == 'R') s[i] = 1;
        if (s[i] == 'G') s[i] = 2;
        if (s[i] == 'B') s[i] = 4;
    }

    // j - i = k - jとなるものを調べる
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            // i番目とj番目が一致
            if (s[i] == s[j]) continue;
            // i と j を固定しているのでk = 2 j - i となる
            int k = 2 * j - i;
            // kがn以上だと組を作れない
            if (k >= n) continue;
            if (s[i] + s[j] + s[k] == 7) condition1--;
        }
    }
    cout << condition1 << endl;
}
*/

int main() {
    int N;
    string S;
    cin >> N >> S;
    long long r = 0, g = 0, b = 0;
    for (auto c : S) {
        if (c == 'R')
            ++r;
        else if (c == 'G')
            ++g;
        else
            ++b;
    }
    long long all = r * g * b;
    long long sub = 0;
    for (int i = 0; i < N; ++i) {
        for (int j = i + 1; j < N; ++j) {
            if (S[i] == S[j]) continue;
            int k = j * 2 - i;
            if (k >= N || S[k] == S[i] || S[k] == S[j]) continue;
            ++sub;
        }
    }
    cout << all - sub << endl;
}

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

int main(){
    int r,d;
    cin>> r >> d;
    vector<int> x(11);
    cin >> x.at(0);
    for(int i=1; i<11; i++){
          x.at(i)=r*x.at(i-1)-d;  
    }
    for(int i=1; i<11; i++){
        cout << x.at(i) << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <map>

using namespace std;

/* -----------------------------------------------------------------------------
	型とクラス定義
----------------------------------------------------------------------------- */
#define MAX_N 100001
typedef std::map<int, int> Map;

/* -----------------------------------------------------------------------------
	大域データ
----------------------------------------------------------------------------- */
int N;
Map m;	// 人数×番号

int main () {


	// 数の読込み
	scanf("%d", &N);

	for(int i = 1; i <= N; i++) {
		int x;
		scanf("%d", &x);
		m[x] = i;
	}

	// 結果出力
	for(auto u : m) printf("%d ", u.second);
	printf("\n");
	return 0;
}

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

long long int N;

// (x + y + z)^2 - (xy + yz + xz) = n; (n <= 10000)
// (x + y + z)^2 <= 10000

// x^2 + y^2 + z^2 < 10000


int main(){
    cin >> N;
    map<int,int> m;

    for(int x = 1;x < 103;x++){
        if(x*x > 10000) break;

        for(int y = 1;y < 103;y++){
            if(x*x + y*y > 10000) break;

            for(int z = 1;z < 103;z++){
                if(x*x + y*y + z*z > 10000) break;

                m[x*x + y*y + z*z + x*y + y*z + x*z]++;
            } 
        }
    }

    for(int i = 1;i < N+1;i++){
        cout << m[i] << endl;
    }

}

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

int main(){
    string S, T;
    int cn = 0;
    cin >> S;
    cin >> T;

    for (int i = 0; i < int(S.length()); ++i) {
        if (S[i] != T[i]) {
            T[i] = S[i];
            cn++;
        }
    }

    cout << cn << endl;
    
    return 0;
}



Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> void Max(T &m, const T q) { if (m < q) m = q; }
template<typename T> void Min(T &m, const T q) { if (m > q) m = q; }
template<typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

lint N, A, B;

int main()
{
    cin >> N >> A >> B;
    cout << min(A, B) << " " << max(0LL, A + B - N) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

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

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

void printVector(const vector<ll>& vec) {
    for (ll value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int main()
{
    IO;

    ll N; cin >> N;
    vl A(N), B(N);

    rep(i, N) cin >> A[i];

    ll M = 0, ans=0;

    rep(i, N) {
        M = max(M, A[i]);
        B[i] = M;
    }

    rpt(i, 1, N) {
        if (B[i - 1] > A[i]) ans += B[i - 1] - A[i];
    }

    cout << ans << endl;

}

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

int main() {
	int a,b;
	cin >> a>>b;
	int sum = 0;
	for(int i = 1; i <= b-a; ++i)
		sum += i;
	cout<<sum-b;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stdio.h>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <deque>
#include <map>
using namespace std;
#define intl long long
int main(){
	int n;
	cin>>n;
	int last=-1;
	int count=0;
	int ans=0;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		if(last==a){
			count++;
		}
		else{
			last=a;
			ans+=count/2;
			count=1;
		}
	}
	ans+=count/2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
vector <long long>v;
int main(){
    int n,a[100000],c;
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    c=1;
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1])c++;
        else c=1;
        if(c==2){
            v.push_back(a[i]);
            c=0;
        }
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    if(v.size()<2)cout<<0<<endl;
    else cout<<v[0]*v[1]<<endl;
    return 0;
}

Measured memory_bytes: 1276
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
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; }

int main(){
    ll X;
    cin >> X;

    ll n = 100;
    ll cnt = 0;
    while(n < X){
        cnt++;
        double risi = n * 0.01;
        ll r = risi;
        n += r;
    }
    cout << cnt << ln;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	ll n;string s,t;
	cin>>n>>s>>t;
	while(s.size()!=0){
		if(s==t){
			break;
		}
		s.erase(s.begin()+0);
		t.pop_back();
	}
	cout << 2*n-s.size();
	// your code goes here
	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(){
    string s,t;
    bool ans = false;

    cin >> s >> t;
    int len  = s.size();
    for(int i=0;i<len;i++){
        if(s == t) {
            ans = true;
            break;
        }
        s = s.back() + s.substr(0,len-1);
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}
    
    

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
	while(1){
		int a[15][15];
		int n; cin >> n ;
		if(!n) break;
		for(int i=0;i<15;i++)
			for(int j=0;j<15;j++) a[i][j]=0;
		int y=n/2+1 ; int x=n/2 ;
		int num=1;
		while(1){
		if(a[y][x]==0) a[y++][x++]=num++;
		else if(a[y][x]!=0) x--,y++;
		if(num>n*n) break;
		if(x>=n) x-=n; if(x<0) x+=n;
		if(y>=n) y-=n; if(y<0) y+=n;
		};
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				cout << setw(4) ;
				cout << a[i][j] ;
			};
			cout << '\n' ;
		};
	};
};

Measured memory_bytes: 1172
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int time = sc.nextInt();
			int t_point = 0;
			int h_point = 0;
			for (int j = 0; j < time; j++) {
				// 最初は堅実にいこうと思ったけどエラーの原因がすぐに特定できないため別の方法をとることにした
//				String t_card = sc.next();
//				String h_card = sc.next();
//
//				int i;
//				for (i = 0; i < ((t_card.length()<h_card.length())?t_card.length():h_card.length()); i++) {
//					if (t_card.charAt(i) == h_card.charAt(i)) ;
//					else if (t_card.charAt(i) > h_card.charAt(i)) {
//						t_point += 3;
//						break;
//					} else {
//						h_point += 3;
//						break;
//					}
//				}
//				if (t_card.length() == i) {
//					if(t_card.length()<h_card.length()) {
//						h_point+=3;
//					}
//					else if(t_card.length()>h_card.length()) {
//						t_point+=3;
//					}
//					else {
//						t_point++;
//						h_point++;
//					}
//				}

				ArrayList<String> cards = new ArrayList<>();
				String t_card = sc.next();
				cards.add(t_card);
				cards.add(sc.next());

				Collections.sort(cards);

				if(cards.get(0).contentEquals(cards.get(1))) {
					t_point++;
					h_point++;
				}else if(cards.get(0)==t_card) {
					h_point+=3;
				}else{
					t_point+=3;
				}
			}
			System.out.println(String.format("%d %d", t_point, h_point));
		}
	}
}


Measured memory_bytes: 32424
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B;
    cin >> A >>B;
    if(A>=13){
        cout << B <<endl;
    }
    else if(6 <= A&&A <= 12){
        cout << B/2<<endl;
    }
    else if(A<6){
        cout << 0 <<endl;
    }
}


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

int main()
{
	string s;
	while(cin >> s){
	int x = 0;
	for(int i=2;i < s.size()-1;i++){
		if(s[i] == 'C') x++;
		else if(s[i] >= 'A' && s[i] <= 'Z') goto go;
	}
	go:
	if(x == 1 && s[0] == 'A' && s[s.size()-1] >= 'a' && s[s.size()-1] <= 'z' && s[1] >= 'a' && s[1] <= 'z') cout << "AC\n";
	else cout << "WA\n";
}
	return 0;
}  


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/interval.hpp>
#include <boost/numeric/interval/io.hpp>
using namespace::std;
namespace mp = boost::multiprecision;
typedef mp::number<mp::cpp_dec_float<32,int64_t>> cfloat;
typedef mp::cpp_int cint;
typedef long long lint;
typedef long long ll;
typedef long double ldouble;
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<double> dvec;
typedef vector<vector<double>> dmat;
typedef vector<vector<vector<double>>> dmat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef vector<vector<vector<string>>> smat3;
typedef vector<pair<lint,lint>> pvec;
typedef vector<vector<pair<lint,lint>>> pmat;
typedef vector<vector<vector<pair<lint,lint>>>> pmat3;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define irep(i) for(lint i = 0;; i++)
#define irep1(i) for(lint i = 1;; i++)
#define irep2(i) for(lint i = 2;; i++)
#define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--)
#define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define PI 3.141592653589793
#define cout (cout<<fixed<<setprecision(15))
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define out(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<"\n";}while(0)
#define out2(v) for(auto i:v)output(i);
#define input(a,n) lint n;cin>>n;vector<lint>a(n);rep(i,n)cin>>a[i];
#define sum(v) accumulate(all(v),0LL)
#define INF (1LL<<60)
#define IINF (1<<30)
#define LINF 9223372036854775807
#define MOD 1000000007
vector<lint> dx={-1,1,0,0,1,1,-1,-1};
vector<lint> dy={0,0,-1,1,1,-1,1,-1};
inline lint gcd(lint a,lint b){return b?gcd(b,a%b):a;}
inline lint lcm(lint a,lint b){return a*b/gcd(a,b);}
lint binary_search(function<bool(lint)> func) {
    lint left = -1;
    lint right =LINF-1;
    while (right - left > 1) {
        lint mid = left + (right - left) / 2;
        if (func(mid)) right = mid;
        else left = mid;
    }
    return right;
}
int main(){
    lint x;
    cin>>x;
    cout<<(x-1)/11*2+((x-1)%11<6?1:2);
}

Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  constexpr int64_t kN = 26;
  int64_t D;
  cin >> D;
  vector<int64_t> C(kN + 1, 0);
  for (int64_t c = 1; c <= kN; ++c) {
    cin >> C[c];
  }
  vector<vector<int64_t>> S(D + 1, vector<int64_t>(kN + 1));
  for (int64_t d = 1; d <= D; ++d) {
    for (int64_t c = 1; c <= kN; ++c) {
      cin >> S[d][c];
    }
  }
  vector<vector<int64_t>> last(D + 1, vector<int64_t>(kN + 1, 0));
  vector<int64_t> contests(D + 1);
  for (int64_t d = 1; d <= D; ++d) {
    cin >> contests[d];
  }

  auto Score = [&](const int64_t day) -> int64_t {
    int64_t score = 0;
    for (int64_t d = 1; d <= day; ++d) {
      last[d] = last[d - 1];
      last[d][contests[d]] = d;
      score += S[d][contests[d]];
      for (int64_t c = 1; c <= kN; ++c) {
        score -= C[c] * (d - last[d][c]);
      }
    }
    return score;
  };

  for (int64_t d = 1; d <= D; ++d) {
    cout << Score(d) << endl;
  }
  return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll H,N,A,ans=0; cin>>H>>N;
  for(int i=0; i<N; i++){
    cin>>A; ans+=A;
  }
  if(H>ans) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>

using namespace std;

typedef struct {
	int i;
	int y;
	int p;
	int id;
} cid_t;

int main(int argc, char **argv) {
	int n, m;
	cin >> n >> m;
	vector<vector<cid_t>> id(n);
	for (int i = 0; i < m; i++) {
		int p, y;
		cid_t c;
		cin >> p >> y;
		c.i = i;
		c.y = y;
		c.p = p;
		c.id = 0;
		id[p-1].push_back(c);
	}
	vector<cid_t> merged(0);
	for (int i = 0; i < n; i++) {
		sort(id[i].begin(), id[i].end(), [](cid_t c1, cid_t c2){return c1.y < c2.y;});
		for (int j = 0; j < id[i].size(); j++) {
			id[i][j].id = j;
		}
		merged.insert(merged.end(), id[i].begin(), id[i].end());
	}
	sort(merged.begin(), merged.end(), [](cid_t c1, cid_t c2){return c1.i < c2.i;});
	for (int i = 0; i < m; i++) {
		cout << setfill('0') << setw(6) << right << merged[i].p << setfill('0') << setw(6) << right << merged[i].id + 1 << endl;
	}
}




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

int main(){
    int N;
    cin >> N;
    int g[15][15];
    rep(i,N) rep(j, N) g[i][j] = -1;
    rep(i, N){
        int a;
        cin >> a;
        rep(j, a){
            int x,y;
            cin >> x >> y;
            x--;
            g[i][x] = y;
        }
    }
    int ans = 0;
    rep(i, 1<<N){
        vector<int> state(N);
        rep(j, N) if(i>>j & 1) state[j] = 1;
        bool check = true;
        rep(j, N){
            if(state[j]){
                rep(k, N){
                    if(g[j][k] == -1) continue;
                    else if(g[j][k] != state[k]) check = false;
                }
            }
        }
        if(check) ans = max(ans, __builtin_popcount(i));
    }
    cout << ans << endl;
    return 0;
}


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

struct coordinate {
    int t, x, y;
    bool operator < (const coordinate &another) const {
        return t < another.t;
    }
};

int main() {
    int n; cin >> n;
    vector<coordinate> vec(n + 1);
    vec[0].t = vec[0].x = vec[0].y = 0;
    for(int i = 1; i < n + 1; i++) cin >> vec[i].t >> vec[i].x >> vec[i].y;

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

    for(int i = 1; i < n + 1; i++) {
        int time_diff = vec[i].t - vec[i - 1].t;
        int dist_diff = abs(vec[i].x - vec[i - 1].x) + abs(vec[i].y - vec[i - 1].y);
        if((time_diff < dist_diff) || (time_diff % 2 == 0 && dist_diff % 2 != 0) || (time_diff % 2 != 0 && dist_diff % 2 == 0)) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  string s;
  cin >> s;
  int ans = 0;
  ans += (s[0] == '7');
  ans += (s[1] == '7');
  ans += (s[2] == '7');
  cout << (0 < ans ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
using Graph=vector<vector<int>>;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}

int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}

int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){
  int n,m;
  cin>>n>>m;
  Graph g(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].pb(b);
    g[b].pb(a);
  }

  vector<int> dist(n,-1);
  queue<int> que;
  dist[0]=0;
  que.push(0);

  while(!que.empty()){
    int x=que.front();
    que.pop();

    for(int nv:g[x]){
      if(dist[nv]!=-1) continue;
      dist[nv]=dist[x]+1;
      que.push(nv);
    }
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<n;i++){
    int co=g[i].size();
    int MIN=100000;
    int numb=0;
    for(int j=0;j<co;j++){
      // MIN=min(MIN,dist[g[i][j]]);
      if(MIN>dist[g[i][j]]){
        MIN=dist[g[i][j]];
        numb=g[i][j];
      }
    }
    numb++;
    cout<<numb<<endl;
  }
  // for (int v=0;v<n;++v) cout<<v<<":"<<dist[v]<<endl;
  
  
}

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

int main()
{
	int N;
	int ans = 0;
	cin >> N;
	vector<vector<int>> dp(12, vector<int>(12,0));

	for (int i = 1; i <= N; i++)
	{
		int check = i;
		int sento;
		int matubi = check % 10;
		while (check != 0)
		{
			sento = check;
			check /= 10;
		}

		dp[sento][matubi]++;
	}

	for (int mae = 0; mae <= 9; mae++)
	{
		for (int ato = 0; ato <= 9; ato++)
		{
			ans += dp[mae][ato] * dp[ato][mae];
		}
	}

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

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

using namespace std;

//--------------------
int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}

//------------
void func() {
    int N, K;
    cin >> N >> K;
    if (N % K == 0) {
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }
}

int main() {
    func();
    return 0;
}

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

using namespace std;
#define MAXN 5000
int c[MAXN][MAXN];
string lcs = "";

void getLCS(string x, string y, int i, int j) {
    // string lcs[max(n, m)];
    if(c[i][j] == 0) {
        return;
    }
    if (x[i - 1] == y[j - 1]) {
        getLCS(x, y, i - 1, j - 1);
        lcs += x[i - 1];
    }
    else if(c[i - 1][j] > c[i][j - 1]){
        getLCS(x, y, i - 1, j);
    } else {
        getLCS(x, y, i, j - 1);
    }
}

void stringLengthAndPrint(string x, string y, int n, int m){
    for(int i = 0; i < n; i++) {
        c[i][0] = 0;
    }
    for(int j = 0; j < m; j++) {
        c[0][j] = 0;
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(x[i - 1] == y[j - 1]) {
                c[i][j] = c[i - 1][j - 1] + 1;
                // lcs[c[i][j]] = x[i - 1];
            } else if(c[i][j - 1] >= c[i - 1][j]) {
                c[i][j] = c[i][j - 1];
            } else {
                c[i][j] = c[i - 1][j];
            }
        }
    }
    getLCS(x, y, n, m);
    cout << lcs << endl;
}

int main() {
    int n, m;
    string x, y;
    cin >> x >> y;
    n = x.length();
    m = y.length();
    
    stringLengthAndPrint(x, y, n, m);
}

Measured memory_bytes: 89472
N = input()
B = input().split(" ")
A = [0]*int(N)

B = list(map(int,B))
total = 0


A[0] = B[0]

for i in range(1,int(N)-1):
    #print(i)
    A[i] = min(B[i],B[i-1])

A[int(N)-1] = B[int(N)-2]
#print(A)
for i in range(int(N)):
    total = A[int(i)] + total

print(total)


Measured memory_bytes: 3064
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    long k=sc.nextLong();
    int[] a=new int[n];
    int[] aa=new int[n];
    int[] tmp;
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt()-1;
    }
    int ans=0;
    while(k>0){
      if((k&1)==1){
        ans=a[ans];
      }
      for(int i=0;i<n;i++){
        aa[i]=a[a[i]];
      }
      tmp=aa;
      aa=a;
      a=tmp;
      k=k>>1;
    }
    System.out.println(ans+1);
  }
}


Measured memory_bytes: 61092
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



int n;
int a[200001];
int b[200001];


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);


	cin >> n;
	rep(i, n)cin >> a[i + 1];
	vector<int> ans;

	for (int i = n ; i >= 1; i--) {
		int s = 0;
		for (int j = i; j <= n; j += i) {
			s += b[j];
		}

		if (s%2 != a[i]) {
			b[i] = 1;
			ans.push_back(i);
		}
	}

	cout << ans.size() << endl;
	for (int x : ans) {
		cout << x << endl;
	}


	return 0;
}

Measured memory_bytes: 2936
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power( ll a, ll n, ll m){
  ll ans = 1;
  while(n){
  if(n&1)
  {
  ans *= a;
  ans%=m;
  }
  a*=a;
  n/=2;
  }
  return ans ;
} 


template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...







int Main(){


 ll a;
 cin>>a;
 a^=1;
 cout<<a<<endl;



return 0;

}






int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}


Measured memory_bytes: 3608