akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int N, M, S;
	cin >> N >> M >> S;
	vector<vector<int>> G(N);
	map<pair<int,int>,int> A;
	map<pair<int,int>,int> B;
	for (int i = 0; i < M; ++ i) {
		int u, v, a, b;
		cin >> u >> v >> a >> b;
		-- u; -- v;
		G[u].push_back(v);
		G[v].push_back(u);
		A[{u,v}] = a;
		A[{v,u}] = a;
		B[{u,v}] = b;
		B[{v,u}] = b;
	}
	vector<int> C(N), D(N);
	for (int i = 0; i < N; ++ i) cin >> C[i] >> D[i];

	vector<vector<ll>> dist(50, vector<ll>(4001, 1LL<<62));
	priority_queue<pair<ll,pair<int,int>>> Q;

	int ss = min(S, 4000);
	dist[0][ss] = 0;
	Q.push({0, {0,ss}});
	vector<ll> res(N, 1LL<<62);
	while (!Q.empty()) {
		ll d = -Q.top().first;
		int u = Q.top().second.first;
		int s = Q.top().second.second;
		Q.pop();
		res[u] = min(res[u], d);
		if (d != dist[u][s]) continue;
		if (s < 4000) {
			int ss = min(s + C[u], 4000);
			ll dd = d + D[u];
			if (dd < dist[u][ss]) {
				dist[u][ss] = dd;
				Q.push({-dd,{u,ss}});
			}
		}
		for (auto x : G[u]) {
			int ss = s - A[{u,x}];
			if (ss >= 0) {
				ll dd = d + B[{u,x}];
				if (dd < dist[x][ss]) {
					dist[x][ss] = dd;
					Q.push({-dd,{x,ss}});
				}
			}
		}
	}
	for (int i = 1; i < N; ++ i) cout << res[i] << endl;
}


Measured memory_bytes: 6840
#include <stdio.h>

int main(void)
{
	int m, f, r, sum;

	while(1){
		scanf("%d%d%d", &m, &f, &r);
		sum = m+f;
		if(m==-1 && f==-1 && r==-1)
			break;
		if(m==-1 || f==-1)
			printf("F\n");
		else if(sum  >= 80)
			printf("A\n");
		else if(sum >= 65)
			printf("B\n");
		else if(sum >= 50)
			printf("C\n");
		else if(sum >= 30)
			if(r >= 50)
				printf("C\n");
			else
				printf("D\n");
		else
			printf("F\n");
	}
	return 0;
}

Measured memory_bytes: 584
fn main() {
    let mut k: usize = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line);
        line.split_whitespace().nth(1).unwrap().parse().unwrap()
    };
    let mut s = String::new();
    std::io::stdin().read_line(&mut s);
    let s: Vec<char> = s.trim().chars().collect();
    let mut ret = 0;
    let mut swapping = false;
    for i in 0..(s.len() - 1) {
        if s[i] == s[i + 1] {
            ret += 1;
        } else if swapping {
            ret += 1;
            swapping = false;
        } else if k > 0 {
            k -= 1;
            ret += 1;
            swapping = true;
        }
    }
    println!("{}", ret);
}


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

int f(int n){
 if(n % 2 == 0) return n / 2;
  else return 3 * n + 1;
}

int main(void){
  int s, temp;
  cin >> s;
  temp = s;
  int count = 1;
  vector<int> a(1000000,0);
  a[temp] = 1;
  while(1){
    temp = f(temp); 
    count++;
    if(a[temp] == 1){
      cout << count;
      return 0;
    }
    else a[temp] = 1;
  }
  
  return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <numeric>

using namespace std;

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

    vector<int> array(N);
    for (int i = 0; i < N; i++)
    {
        cin >> array[i];
    }
 
    int sum = accumulate(array.begin(), array.end(), 0);
    int max = *max_element(array.begin(), array.end());

    if (max < sum - max)        
    {
        cout << "Yes";
    }else {
        cout << "No";
    }
    

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
    long int x;
    scanf("%ld", &x);
    long int moto = 100;
    long int ans = 0;
    while (moto < x){
        ans++;
        double motof = (double)moto;
        moto = (long int)motof*1.01;
    }
    printf("%ld", ans);
    return 0;
}


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

int main()
{
  int N, M;
  cin >> N >> M;
  vector<vector<int>> vec(M);

  for (int i = 0; i < M; i++)
  {
    int k;
    cin >> k;
    vec.at(i).resize(k);
    for (int j = 0; j < k; j++)
    {
      cin >> vec.at(i).at(j);
      vec.at(i).at(j)--;
    }
  }

  vector<int> p(M);
  for (int i = 0; i < M; i++)
  {
    cin >> p.at(i);
  }

  int ans = 0;
  for (int bit = 0; bit < (1 << N); bit++)
  {
    bool ok = true;
    for (int j = 0; j < M; j++)
    {
      int c = 0;
      for (int id : vec[j])
      {
        if ((bit >> id) & 1)
        {
          c++;
        }
      }
      c %= 2;
      if (c != p[j])
      {
        ok = false;
      }
    }
    if (ok)
    {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#define rep(i,n) for(int i=0;i<(n);i++)
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x;
  cin >> n >> m >> x;
  vector<int> c(n);
  int a[n][m];
  rep(i,n){
    cin >> c[i];
    rep(j,m)
      cin >> a[i][j];
  }
  int ans=INT_MAX;
  rep(i,1<<n){
    int answer=0;
    vector<int> temp(m);
    rep(j,n){
      if((i>>j)&1){
        answer+=c[j];
        rep(k,m)temp[k]+=a[j][k];
      }
    }
    rep(j,m) if(temp[j]<x)answer=INT_MAX;
    ans=min(answer,ans);
  }
  cout <<(INT_MAX==ans?-1:ans) << endl;
  return 0;
}


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

void solve(){
    int n,k;
    cin>>n>>k;
    vector<int> mat(n);
    for(int &x:mat) cin>>x;
    
    vector<int> dp(k+1);
    
    for(int i=0;i<=k;i++){
        for(int x:mat){
            if(i-x>=0 && dp[i-x]==0){
                dp[i]=true;
            }
        }
    }
    if(dp[k]) cout<<"First";
    else cout<<"Second";
}

int main() {
	// your code goes here
	//freopen("inptmp0.txt","r",stdin);
	int T;
	
	//cin>>T;
	T=1;
	while(T--){
	    solve();
	}
	return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
struct UnionFind{
    vector<int> parent;
    vector<long long> edge;
    vector<long long> node;

    UnionFind(int N) : parent(N, -1), edge(N, 0), node(N, 0) {}

    void print(int x){
        printf("%d: parent:%d edge:%lld node:%lld\n", x, parent[x], edge[x], node[x]);
    }

    // (root_index, root_value - x_value)
    pair<int, long long> root(int x){
        if(parent[x] < 0){
            return make_pair(x, 0);
        }else{
            pair<int, long long> p = root(parent[x]);
            p.second += edge[x] + node[parent[x]];

            // update
            parent[x] = p.first;
            edge[x] = p.second - node[ parent[x] ]; // edge + node[parent] = p.second
            return p;
        }
    }

    void unite(int x, int y, int c){
        // y - x = c
        node[x] += c;
        node[y] += c;
        edge[x] -= c;
        edge[y] -= c;

        pair<int, long long> px = root(x);
        pair<int, long long> py = root(y);
        if(px.first == py.first) return;
        parent[px.first] = py.first;
        edge[px.first] = py.second - px.second + c - node[py.first];

    }

    // return y - x
    long long compare(int x, int y){
        pair<int, long long> px = root(x);
        pair<int, long long> py = root(y);
        if(px.first != py.first) return LLONG_MIN;
        return -(py.second - px.second);
    }
};

int main(){
    int N, Q;
    while(cin >> N >> Q){
        UnionFind UF(N + 1);
        while(Q --> 0){
            string query;
            cin >> query;
            if(query == "COMPARE"){
                int x, y;
                cin >> x >> y;
                long long answer = UF.compare(x, y);
                cout << (answer > LLONG_MIN ? to_string(answer) : "WARNING") << endl;
            }else if(query == "IN"){
                int x, y, c;
                cin >> x >> y >> c;
                UF.unite(x, y, c);
            }
        }
    }
    return 0;
}

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

using namespace std;

int ans;
int qtdRock;
int qtdPaper;

string s;

int main()
{
	cin >> s;

	for(int i = 0 ; i < s.size() ; i++)
	{
		if( qtdPaper == qtdRock )
		{
			qtdRock++;
			if( s[i] == 'p' ) ans--;
		}
		else
		{
			qtdPaper++;
			if( s[i] == 'g' ) ans++;
		}
	}

	printf("%d\n",ans);
}

Measured memory_bytes: 512
/* ****revpro**** */
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
void solve()
{
  string s,t;
  cin>>s>>t;
  int ans=hell;
  rep(i,0,sz(s)){
    if(i+sz(t)<=sz(s)){
      int cnt=0;
      rep(j,0,sz(t)){
        if(s[i+j]!=t[j]) cnt++; 
      }
      
    ans=min(ans,cnt);
    }
  }
  cout<<ans<<endl;
}
signed main()
{
  
    /***********************************/
    unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
    mt19937_64 generator (seed);
    /***********************************/
 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    solve();
    
  }
  TIME
  return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(ll i=0;i<(n);i++)

using namespace std;



int main(){
    int n;
    cin >> n;
    vector<map<char, int>> list(n);
    rep(i, n){
        string s;
        cin >> s;
        for(auto c : s) list[i][c]++;
    }

    map<char, int> res;
    for(auto iter = list[0].begin(); iter != list[0].end(); iter++){
        res[iter->first] = iter->second;
    }

    rep(i, n){
        for(auto iter = res.begin(); iter != res.end(); iter++){
            char k = iter->first;
            int v = iter->second;
            res[k] = min(v, list[i][k]);
        }
    }

    set<char> keyset;
    for(auto iter = res.begin(); iter != res.end(); iter++){
        keyset.insert(iter->first);
    }

    string ans = "";
    for(auto key : keyset){
        rep(i, res[key])    ans += key;
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
import * as fs from 'fs';

const readString = (() => {
  const input = fs.readFileSync(0).toString();
  const words = input.split(/[ \n]/);
  let i = 0;
  return () => words[i++] || '';
})();
const readInt = () => parseInt(readString(), 10);

(function main() {
  const K = readInt();
  const S = readString();
  if (S.length > K) {
    console.log(S.substring(0, K) + '...');
  } else {
    console.log(S);
  }
})();



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

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

  ll N; cin >> N;
  vector<ll> A(N); for (ll i = 0; i < N; i++) cin >> A[i];

  ll cnt = 0;
  for (ll i = 0; i < N; i++) {
    for (ll j = 0; j < N - 1 - i; j++) {
      if (A[j] > A[j + 1]) {
        swap(A[j], A[j + 1]);
        cnt++;
      }
    }
  }
  cout << A[0]; for (int i = 1; i < A.size(); i++) { cout << ' ' << A[i]; }
  cout << '\n' << cnt << '\n';
  return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> multi_vector(size_t a){return vector<T>(a);}template<class T, class... Ts>auto multi_vector(size_t a, Ts... ts){return vector<decltype(multi_vector<T>(ts...))>(a, multi_vector<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  ll N;
  string S;
  cin >> N >> S;
  vector<ll> vec(27);
  for(auto&& i : S){
    vec[i - 'a']++;
  }
  ll ans{1};
  for(auto&& i : vec){
    ans *= i+1;
    ans %= MOD;
  }
  ans += MOD;
  ans--;
  ans %= MOD;
  cout << ans << rt; 
}

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

using namespace std;

using i64 = int64_t;
const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


signed main(){
    int n, k;
    cin >> n >> k;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(i && s[i] == 'L' && s[i - 1] == 'L')
            ++ans;
        if(i != n - 1 && s[i] == 'R' && s[i + 1] == 'R')
            ++ans;
    }
    int tmp = s[0];
    int cnt = 1;
    for(int i = 1; i < n; ++i)
        if(s[i] != tmp){
            ++cnt;
            tmp = s[i];
        }
    assert(ans == n - cnt);
    for(int i = 0; i < k; ++i){
        if(cnt == 1)
            break;
        if(cnt == 2)
            cnt -= 1;
        else
            cnt -= 2;
        if(cnt == 1)
            break;
    }
    cout << n - cnt << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

class DisjointSet{
public:
  vector<int> rank,p;
  vector<int> sz;
 
  DisjointSet(){}
  DisjointSet(int size){
    rank.resize(size,0);
    p.resize(size,0);
    sz.resize(size,0);
    for(int i=0;i<size;i++) makeSet(i);
  }
 
  void makeSet(int x){
    p[x]=x;
    rank[x]=0;
    sz[x]=1;
  }
 
  bool same(int x,int y){
    return findSet(x)==findSet(y);
  }
 
  void unite(int x,int y){
    if(same(x,y)) return;
    link(findSet(x),findSet(y));
  }
 
  void link(int x,int y){
    if(rank[x]>rank[y]){
      p[y]=x;
      sz[x]+=sz[y];
    }else{
      p[x]=y;
      sz[y]+=sz[x];
      if(rank[x]==rank[y]){
        rank[y]++;
      }
    }
  }
 
  int findSet(int x){
    if(x!=p[x]){
      p[x]=findSet(p[x]);
    }
    return p[x];
  }
 
  int findSize(int x){
    return sz[findSet(x)];
  }
};

ll mod_pow(ll x,ll n){
  x%=MOD;
  ll res=1;
  while(n>0){
    if(n&1) res=res*x%MOD;
    x=x*x%MOD;
    n>>=1;
  }
  return res;
}

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

void mul(ll &a,ll b){
  a%=MOD;b%=MOD;
  a=a*b%MOD;
}

int N,M;
ll X;

ll calc(int now,vector<tuple<ll,int,int>> &edges){
    DisjointSet us(N);
    ll res=0;
    us.unite(get<1>(edges[now]),get<2>(edges[now]));
    res+=get<0>(edges[now]);

    for(auto e:edges){
        ll c=get<0>(e);
        int a=get<1>(e);
        int b=get<2>(e);
        if(us.same(a,b)) continue;

        us.unite(a,b);
        res+=c;
    }
    if(us.findSize(0)<N) return -1;
    return res;
}

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

  cin>>N>>M;
  cin>>X;
  vector<tuple<ll,int,int>> edges;
  rep(i,M){
      int a,b,c;
      cin>>a>>b>>c;
      a--;b--;
      edges.push_back(mkt(c,a,b));
  }
  sort(edges.begin(),edges.end());

  vector<ll> val(M,0);
  rep(i,M){
      val[i]=calc(i,edges);
      if(val[i]==-1){
          cout<<0<<endl;
          return 0;
      }
  }

  ll minus=0,zero=0,plus=0;
  rep(i,M){
      if(val[i]<X) minus++;
      else if(val[i]==X) zero++;
      else plus++;
  }

  if(zero==0){
      cout<<0<<endl;
      return 0;
  }

  ll all=mod_pow(2ll,minus+zero);
  add(all,MOD-2);
  mul(all,mod_pow(2ll,plus));

  ll dif=0;
  if(minus>0){
      dif=mod_pow(2ll,minus);
      add(dif,MOD-2);
      mul(dif,(mod_pow(2ll,zero+plus)));
  }
  dif%=MOD;
  
  ll ans=all;
  add(ans,MOD-dif);
  cout<<ans<<endl;



  return 0;
}


Measured memory_bytes: 384
from collections import defaultdict as d
from itertools import accumulate as ac
n,k=map(int,input().split())
a=[0]+list(ac(list(map(int,input().split()))))
b=d(int)
c=0
for i in range(n+1):
    p=(a[i]-i)%k
    c+=b[p]
    b[p]+=1
    if i-k+1>=0:
        b[(a[i-k+1]-i+k-1)%k]-=1
print(c)

Measured memory_bytes: 40712
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int d = sc.nextInt();
        int[] x = new int[11];
        x[0] = sc.nextInt();
        for (int i = 1; i <= 10; i++) {
            x[i] = r * x[i - 1] - d;
            System.out.println(x[i]);
        }
        sc.close();
    }
}

Measured memory_bytes: 21460
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
int main(void){
    long long n,m,i,j,ans=0;
    cin >> n >> m;
    vector<pair<long long,long long>>a(n);
    for(i=0;i<n;i++) cin >> a[i].first >> a[i].second;
    sort(a.begin(),a.end());
    for(i=0;i<n;i++){
        long long x = min(m,a[i].second);
        ans+=x*a[i].first;
        m-=x;
        if(m==0) break;
    }
    cout << ans;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    static Scanner cin;

    void calc()
    {
        string S = cin.next();

        const int N = 13;
        //dp[k] -> 13で割った余りがKのパターン数
        long[] dp = new long[N];
        dp[0] = 1;

        //前から解くアルゴリズム
        // 1?2?3   0 -> 1 -> 1? -> 1?2 -> ...
        long mod = 1000000007;

        for (int i = 0; i < S.Length; i++)
        {
            //次の状態
            long[] nextDP = new long[N];

            char c = S[i];
            if(c == '?')
            {
                for (int k = 0; k < 10; k++)
                {
                    for (int j = 0; j < N; j++)
                    {
                        nextDP[((j * 10) + k) % N] += dp[j];
                        nextDP[((j * 10) + k) % N] %= mod;
                    }
                }
            }
            else
            {
                int k = (int)(S[i] - '0');
                for (int j = 0; j < N; j++)
                {
                    nextDP[((j * 10) + k) % N] += dp[j];
                    nextDP[((j * 10) + k) % N] %= mod;
                }
            }

            dp = nextDP;
        }

        Console.WriteLine(dp[5]);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

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

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

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

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

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

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

template < typename A, size_t N, typename T >
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	string ans = "No";
	vector< pii > D(N);
	rep(i, N) cin >> D[i].first >> D[i].second;
	rep(i, N - 2) {
		if (D[i].first == D[i].second && D[i + 1].first == D[i + 1].second && D[i + 2].first == D[i + 2].second)
			ans = "Yes";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
char s[10];
int main(){
	scanf("%s",s);
	int fg=1;
	for(int i=1;i<4;i++){
		if(s[i]==s[i-1]){
			fg=0;
		}
	}
	if(fg){
		printf("Good\n");
	}
	else{
		printf("Bad\n");
	}
	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 X = sc.nextInt();
            int t = sc.nextInt();
            int C = 0;
            int ans = X - t;
            
        	if(X <= t){
	            System.out.println(C);
        }else{
            System.out.println(ans);
    }
        }
    }
    

Measured memory_bytes: 23380
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)

signed main(){
    int a,b;cin>>a>>b;
    int res=1;
    if(a<=0&&b>=0)res=0;
    else if(a<0&&b<0){
        res=(b-a)%2;
        if(res==0)res=-1;
        else res=1;
    }
    else{
        res=1;
    }
    if(a==0)res=0;
    if(b==0)res=0;
    if(res==0){
        cout<<"Zero";
    }
    else if(res<0){
        cout<<"Negative";
    }
    else {
        cout<<"Positive";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
// ALDS1_11_B
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

vector<vector<int>> node(101);
vector<int> setu(101);
vector<bool> seen(101,false); 
vector<int> start(101,0);
vector<int> goal(101,0);
int t=0;
void dfs(int x){
    if(seen[x]==true) return;
    seen[x]=true;
    t++;
    start[x]=t;
    rep(i,setu[x]){
        dfs(node[x][i]);
    }
    t++;
    goal[x]=t;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n;
    cin>>n;
    rep(i,n){
        int u,k;
        cin>>u>>k;
        rep(j,k){
            int v;
            cin>>v;
            node[u].push_back(v);
            setu[u]=k;
        }
    }
    for(int i=1;i<=n;i++){
        dfs(i);
    }
    for(int i=1;i<=n;i++){
        cout<<i<<" "<<start[i]<<" "<<goal[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3224
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    a=parseMap(split(readline()))
    cnt=Dict{Int,Int}()
    for i in a
        if haskey(cnt,i)
            cnt[i]+=1
        else
            cnt[i]=1
        end
    end
    ans=0
    for key in keys(cnt)
        if cnt[key]<key
            ans+=cnt[key]
        else
            ans+=cnt[key]-key
        end
    end
    println(ans)    
end
main()

Measured memory_bytes: 166920
'use strict';
(function(stdin) {
  //declare function

  //declare variable
  var inputs = stdin.toString().trim().split('\n');
  var result = [];
  //main
  for (var i = 1; i <= inputs[0]; i++) {
    if (i % 3 === 0) {
      result.push(i);
    } else {
      for (var l = i; l >= 3; l = parseInt(l / 10)) {
        if (l % 10 === 3) {
          result.push(i);
          break;
        }
      }
    }
  }
  //display
  console.log(' ' + result.join(' '));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 17232
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
  
int n,m;
vector<vector<int>> G;

void solve(){
    vector<int> dist(n,-1);
    vector<int> prev(n,-1);

    queue<int> que;
    que.push(0);
    dist[0] = 0;

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

        for(auto nv: G[v]){
            if(dist[nv] == -1){
                dist[nv] = dist[v];
                prev[nv] = v;
                que.push(nv);
            }
        }

    }

    cout << "Yes" << endl;
    
    for(int i = 1; i < n; i++){
        cout << prev[i] + 1 << endl;
    }



}

int main(){
    cin >> n >> m;
    G.assign(n,vector<int>());

    for(int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b; a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    solve();


}

Measured memory_bytes: 10684
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
const int N=1<<18,mo=998244353,inv2=(mo+1>>1);
ll a[N],b[N],n,c[N];
ll power(ll a,ll b=mo-2){
	ll ans=1;
	while (b){
		if (b&1)ans=ans*a%mo;
		a=a*a%mo;
		b>>=1;
	}return ans;
}
void fwt(ll *a,int M=1<<n){
	for (int n=1;n<M;n<<=1)
		for (int i=n;i<M;i=(i+1)|n){
			ll z=a[i^n];
			a[i^n]=(a[i]+a[i^n])%mo;
			a[i]=(z-a[i]+mo)%mo;
		}
}
void ifwt(ll *a,int M=1<<n){
	for (int n=1;n<M;n<<=1)
		for (int i=n;i<M;i=(i+1)|n){
			ll z=a[i^n];
			a[i^n]=(a[i]+a[i^n])*inv2%mo;
			a[i]=(z-a[i]+mo)*inv2%mo;
		}
}
int main(){
	cin>>n;
	ll sum=0;
	for (int i=0;i<1<<n;i++)scanf("%lld",&a[i]),sum+=a[i],b[i]=mo-1;
	sum=power(sum);
	for (int i=0;i<1<<n;i++)a[i]=a[i]*sum%mo;
	fwt(a);fwt(b);
	sum=0;
	ll G=(1<<n)-1;
	for (int i=1;i<1<<n;i++)c[i]=(G+1)*power(a[i]-1)%mo,c[0]=(c[0]+(mo-c[i]))%mo;
	ifwt(c);
	for (int i=0;i<1<<n;i++)printf("%lld\n",(c[i]%mo+mo)%mo);
	
}

Measured memory_bytes: 8960
#include <stdio.h>
int main(void){
	int a,b,c,i,j=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0){
			j++;
		}
	}
		printf("%d\n",j);
	return 0;
}

Measured memory_bytes: 596
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
 
        
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if( a < 9 && b < 9)
            System.out.println("Yay!");
        else
            System.out.println(":(");
    }
}

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

int main(){

  int N;
  int P,W,G,Y;

  cin>>N;

  rep(i,N){
  
    string x;
    cin>>x;
  
  if(x=="P")
    P++;
   
    else if(x=="W")
    W++;
  
    else if(x=="G")
    G++;
  
    else if(x=="Y")
    Y++;
}
  if(Y>0)
    cout << "Four" << endl;
  else
    cout << "Three" <<endl;
}

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;

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    vector<vector<int>> count(H, vector<int>(W));
    rep(i, H) cin >> S[i];

    //左右
    rep(i, H) {
        vector<int> visit(W);
        rep(j, W) {
            if(S[i][j] == '#') continue;
            if(visit[j]) continue;
            int k=0;
            while(j+k < W) {
                if(S[i][j+k] == '#') break;
                k++;
            }
            rep(l, k) {
                count[i][j+l] += k;
                visit[j+l] = 1;
            }
        }
    }

     rep(j, W) {
        vector<int> visit(H);
        rep(i, H) {
            if(S[i][j] == '#') continue;
            if(visit[i]) continue;
            int k=0;
            while(i+k < H) {
                if(S[i+k][j] == '#') break;
                k++;
            }
            rep(l, k) {
                count[i+l][j] += k;
                visit[i+l] = 1;
            }
        }
    }

    int max = 0;
    rep(i, H) {
        rep(j, W) {
            if(count[i][j]-1 > max) max = count[i][j] - 1;
        }
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 20096
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1
 
struct Node{ int p, l, r;};
 
Node T[MAX];
int n, D[MAX];
 
void print(int u){
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "depth = " << D[u] << ", ";
    if(T[u].p==NIL) cout << "root, ";
    else if(T[u].l==NIL) cout << "leaf, ";
    else cout << "internal node, ";
     
    cout << "[";
     
    for(int i=0, c = T[u].l; c!=NIL; i++, c=T[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}
 
void rec(int u, int p){
    D[u] = p;
    if(T[u].r != NIL) rec(T[u].r,p);
    if(T[u].l != NIL) rec(T[u].l, p+1);
}
 
int main(){
    int i,j,d,v,c,l,r;
    cin >> n;
    for(int i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
     
    for(i=0; i<n; i++){
        cin >> v >> d;
        for(j=0; j<d; j++){
            cin >> c;
            if(j==0) T[v].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = v;
        }
    }
    for(i=0; i<n; i++){
        if(T[i].p==NIL) r = i;
    }
     
    rec(r,0);
     
    for(i=0; i<n; i++) print(i);
     
    return 0;
}

Measured memory_bytes: 7788
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int N;
    cin >> N;
    vector<int> A(N);
    for (auto &&i : A) {
        cin >> i;
    }

    bool flag = true;
    int i     = 0;
    int cnt   = 0;
    while (flag) {
        flag = false;
        for (int j = N - 1; j >= i + 1; j--) {
            if (A[j] < A[j - 1]) {
                swap(A[j], A[j - 1]);
                flag = true;
                cnt++;
            }
        }
        i++;
    }
    for (int i = 0; i < N; i++) {
        cout << A[i];
        i == N - 1 ? cout << '\n' : cout << ' ';
    }
    std::cout << cnt << '\n';

    return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef complex <double> cp;
#define debug(a) cout<<#a<<":"<<a<<endl;
#define fr freopen("in.txt","r",stdin);
#define Fill(x,a) memset(x,a,sizeof(x))
#define cpy(a,b) memcpy(a,b,sizeof(a))
const double PI = acos(-1);
const int INF=0x3f3f3f3f;
const int N=1e6+7;
const int mod=1e9+7;
int maxn,minn;
int T,n,m,q;

int pre[N];

void init(){
	for(int i = 1; i <= n; i ++ ){
		pre[i] = i;
	}
}

int find(int a){
	if(pre[a] == a)	return a;
	return pre[a] = find(pre[a]);
}

void join(int a,int b){
	int aa = find(a);
	int bb = find(b);
	if(aa != bb){
		pre[aa] = pre[bb];
	} 
}


int main(){
	int u,v;
	cin >> n >> m;
	init();
	for(int i = 1; i <= m; i ++ ){
		scanf("%d%d",&u,&v);
		join(u,v);
	}
	map<int,int>mp;
	maxn = 0;
	for(int i = 1; i <= n; i ++ ){
		mp[find(i)] ++ ;
		maxn = max(maxn, mp[pre[i]]);
	}
	cout << maxn << endl;
	
	
	
	


	return 0;
}



Measured memory_bytes: 13624
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

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

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<62)           //1LL<<63でオーバーフロー

int main(int argc,char* argv[]){
    int n,k;
    cin >> n >> k;

    vector<ll> a(n);
    for(auto &x:a)
        cin >> x;

    vector<bool> judge(n,false);
    for(int i=k;i<n;i++){
        if(a.at(i)>a.at(i-k)) judge.at(i)=true;
    }

    for(int i=k;i<n;i++){
        if(judge.at(i)) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 4840
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef  pair<int,int> P;
typedef long long LL;
typedef vector<LL> VEC;

const LL INF=1<<30;
const LL MOD=1000000007;




int main(){
    int n;
    cin>>n;
    VEC a(n);
    for(int i=0;i<n;++i){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    int ans=0;
    int now=a[0];
    bool noww=false;
    for(int i=0;i<n;++i){
        if(a[i]==now)noww=!noww;

        if(i<n-1&&now!=a[i+1]){
            if(noww)ans++;
            noww=false;
            now=a[i+1];
        }
    }
    if(noww)ans++;

    cout<<ans<<endl;
}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
string a,b,c;
int main(){
	cin>>a>>b>>c;
	if(a[a.length()-1]==b[0]&&b[b.length()-1]==c[0]) printf("YES\n");
	else printf("NO");
	return 0;
}
//QAZWSXEDCRFVTGBYHNUJMIKOLP


Measured memory_bytes: 256
<?php

    // AtCoder Beginner Contest 163
    // A - Circle Pond

    $r = in_int();
    out($r * 2 * pi());

    // -----------------------------------------------------
    function in() { return trim(fgets(STDIN)); }
    function in_int() { return (int)in(); }
    function in_vals() { return explode(' ', in()); }
    function in_ints() { return array_map('intval', in_vals()); }
    function out($s) { echo $s . PHP_EOL; }
    function yes() { out('Yes'); }
    function no() { out('No'); }


Measured memory_bytes: 16164
#include <bits/stdc++.h>
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

inline void add(int &a, int b) { a += b; if(MOD <= a) a -= MOD; }

int D[2][305][305];

int A[305][3], B[305][3];

int N, Q, Ans;

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

	cin >> N >> Q; N += 2;
	for(int i = 0; i <= N; i++)
		A[i][0] = A[i][1] = i+1;
	for(int a, b, c; Q--;) {
		cin >> a >> b >> c;
		a += 2; b += 2; c--;
		if(!c) upmin(A[b][0], a);
		else if(1 == c) {
			upmin(A[b][1], a);
			upmax(B[b][1], a);
		} else upmax(B[b][2], a);
	}

	D[0][1][0] = 1;
	for(int i = 3; i <= N; i++) {
		int mna = 1, mxa = i-1, mnb = 0, mxb = i-2;
		upmin(mxa, A[i][0]-1);
		upmax(mna, B[i][1]);
		upmin(mxb, A[i][1]-1);
		upmax(mnb, B[i][2]);
		if(mna > mxa || mnb > mxb) { puts("0"); exit(0); }
		auto f = [&](int a, int b, int t) {
			if(a < mna || mxa < a || b < mnb || mxb < b) return;
			add(D[i][a][b], t);
		};
		for(int a = 1, t; a < i-1; a++) for(int b = 0; b < a; b++) {
			t = D[0][a][b]; if(!t) continue;
			add(D[1][a][b], t);
			add(D[1][i-1][b], t);
			add(D[1][i-1][a], t);
		}
		memset(D[0][0], 0, 305*305*4);
		for(int a = mna, l = (mxb-mnb+1)*4; a <= mxa; a++)
			memcpy(D[0][a]+mnb, D[1][a]+mnb, l);
		memset(D[1][0], 0, 305*305*4);
	}

	for(int a = 1; a < N; a++) for(int b = 0; b < a; b++)
		add(Ans, D[0][a][b]);
	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 1024
s = input()
t = input()
s = list(s)
t = list(t)
num = 0
for i in range(len(s)):
    s.append(s[0])
    s.pop(0)
    if s == t:
        print('Yes')
        num += 1
        break
    else:
        pass
if num == 0:
    print('No')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int n;
    ll a, oddcnt=0;
    cin >> n;
    rep(i, n){
        cin >> a;
        if(a%2 == 1) oddcnt++;
    }

    if(oddcnt%2 == 1){
        ans2(false);
    }else{
        ans2(true);
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

template<class T>
struct edge{
  int from,to;
  T cost;

  edge(int to,T cost):from(-1),to(to),cost(cost){}
  edge(int from,int to,T cost):from(from),to(to),cost(cost){}
};
template<class T>
using Edges = vector<edge<T>>;

//bellman_ford(重み付き辺の集合,頂点数,始点)
//始点sからの最短距離のvectorを返す
//負の閉路があるときは空のvectorを返す
template<class T>
vector<T> bellman_ford(Edges<T> &edges,int V,int s){
  const auto INF=numeric_limits<T>::max();
  vector<T> dist(V,INF);

  dist.at(s)=0;
  for(int i=0;i<V;i++){
    for(auto &e : edges){
      if(dist.at(e.from)==INF)  continue;
      chmin(dist.at(e.to),dist.at(e.from)+e.cost);
    }
  }
  for(auto &e : edges){
    if(dist.at(e.from)==INF)  continue;
    if(dist.at(e.to)>dist.at(e.from)+e.cost)  return vector<T>();
  }
  return dist;
}

void dfs_can_visit_to(vector<vector<int>> &graph_to,vector<bool> &can_visit_to,int v){
  can_visit_to.at(v)=true;
  for(int i=0;i<sz(graph_to.at(v));i++){
    int nv=graph_to.at(v).at(i);
    if(can_visit_to.at(nv)) continue;
    dfs_can_visit_to(graph_to,can_visit_to,nv);
  }
}

void dfs_can_visit_from(vector<vector<int>> &graph_from,vector<bool> &can_visit_from,int v){
  can_visit_from.at(v)=true;
  for(int i=0;i<sz(graph_from.at(v));i++){
    int nv=graph_from.at(v).at(i);
    if(can_visit_from.at(nv)) continue;
    dfs_can_visit_from(graph_from,can_visit_from,nv);
  }
}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N,M,P;
  cin >> N >> M >> P;
  Edges<ll> edges;
  vector<vector<int>> graph_to(N);
  vector<vector<int>> graph_from(N);
  for(int i=0;i<M;i++){
    int a,b;
    ll c;
    cin >> a >> b >> c;
    a--;
    b--;
    c-=P;
    edges.e_b(a,b,-c);
    graph_to.at(a).e_b(b);
    graph_from.at(b).e_b(a);
  }

  vector<bool> can_visit_to(N,false);
  vector<bool> can_visit_from(N,false);
  dfs_can_visit_to(graph_to,can_visit_to,0);
  dfs_can_visit_from(graph_from,can_visit_from,N-1);
  Edges<ll> edges_can_use;
  for(auto &e : edges){
    if(!can_visit_to.at(e.from) || !can_visit_to.at(e.to))  continue;
    if(!can_visit_from.at(e.to) || !can_visit_from.at(e.from))  continue;
    edges_can_use.e_b(e);
  }

  vector<ll> ans=bellman_ford(edges_can_use,N,0);
  if(sz(ans)==0)  cout << -1 << endl;
  else  cout << max(ll(0),-ans.at(N-1)) << endl;

  return 0;
}

Measured memory_bytes: 4196
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  int n;
  cin>>n;
  bool f=true;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(a%2==1)f=false;
  }
  if(!f)cout<<"first"<<endl;
  else cout<<"second"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
int main(){
    int H, W; cin >> H >> W;
    int M[H][W];
    for(int i = 0; i < H; i++){
        string S; cin >> S;
        for(int j = 0; j < W; j++){
            if(S[j] == '.') M[i][j] = 1;
            else M[i][j] = 0;
            //cout << M[i][j];
        }
        //cout << endl;
    }
    int sh[4] = {1, 0, -1, 0};
    int sw[4] = {0, 1, 0, -1};
    int max = 0;

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(M[i][j] == 0) continue;
            //cout << i << " " << j << endl;
            queue<int> qh, qw;
            int maze[H][W];
            int map[H][W];
            memset(maze, 0, sizeof(maze));
            memset(map, 0, sizeof(map));
            int sth = i; int stw = j;
            qh.push(sth); qw.push(stw); 
            map[i][j] = 1;
            while(!qh.empty()){
                
                int h = qh.front(); int w = qw.front();
                //cout << "  " << h << " " << w << endl;
                qh.pop(); qw.pop();
                for(int i = 0; i < 4; i++){
                    int nx_h = h + sh[i];
                    int nx_w = w + sw[i];
                    if(0 <= nx_h && nx_h < H && 0 <= nx_w && nx_w < W){ //範囲内なら
                      //cout << "   " << nx_h << " " << nx_w <<" " <<  maze[nx_h][nx_w] << endl;
                        if(M[nx_h][nx_w] == 1){ //障害物がないなら
                            //cout << "    " << nx_h << " " << nx_w <<" " << endl;
                             if(map[nx_h][nx_w] == 0){ //未探索か最小でいける
                                //cout << "    " << nx_h << " " << nx_w <<" " << endl;
                                qh.push(nx_h);
                                qw.push(nx_w);
                                maze[nx_h][nx_w] = maze[h][w] + 1;
                                map[nx_h][nx_w] = 1;
                                if(max < maze[nx_h][nx_w]) max = maze[nx_h][nx_w];
                             }
                        }
                    }
                }
            }
            //cout << max << endl;
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 256