akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

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

int main(){
    ll n; cin >> n;
    ll a;
    ll l;
    rep(i,n){
        cin >> a;
        if(i == 0)  l = a;
        else l = GCD(a,l);
    }
    cout << l << endl;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair

bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 

int n,m;
vector<int> g[1000000];
int dp[1000000];

int dfs(int x){
    if(dp[x]!=-1)
        return dp[x];
    int ans=0;
    for(int i=0;i<g[x].size();i++)
        ans=max(ans,dfs(g[x][i])+1);
    dp[x]=ans;
    return ans;
}

int main()
{
    IOS;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        g[u-1].push_back(v-1);
    }
    for(int i=0;i<n;i++)
        dp[i]=-1;
    int ans=0;
    for(int i=0;i<n;i++){
        ans=max(ans,dfs(i));
    }
    cout<<ans;
}


Measured memory_bytes: 31104
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<cstring>
#include<utility>
#include<vector>
#include<memory> 
using namespace std;

int n,m;
string a[55],b[55];

int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<m;i++)
	{
		cin>>b[i];
	}
	bool flag;
	for(int i=0;i<=n-m;i++)
	{
		for(int j=0;j<=n-m;j++)
		{
			flag=true;
			for(int ii=0;ii<m;ii++)
			{
				for(int jj=0;jj<m;jj++)
				{
					if(a[i+ii][j+jj]!=b[ii][jj])
					{
						flag=false;
					}
				}
			}
			if(flag==true)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	} 
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 998244353;
typedef long long LL;
typedef pair<LL, LL> P;

LL add(LL a, LL b) { return (a + b) % kMod; }
LL sub(LL a, LL b) { return (a + kMod - b) % kMod; }

int main() {
  LL N, K; cin >> N >> K;
  vector<P> ps(K);
  for (int i = 0; i < K; ++i) {
    LL L, R; cin >> L >> R; ps[i] = {L, R};
  }

  vector<LL> dp(N + 1, 0), S(N + 1, 0);
  dp[0] = 1, dp[1] = 1, S[1] = 1;
  for (int i = 2; i <= N; ++i) {
    for (auto [first, second] : ps) {
      LL L = i - second;
      LL R = i - first;
      if (R < 0) continue;
      if (L < 1) L = 1;
      dp[i] = add(dp[i], sub(S[R], S[L-1]));
    }
    S[i] = (S[i-1] + dp[i]) % kMod;
  }
  cout << dp[N] << endl;
}


Measured memory_bytes: 6392
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
// #define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
typedef vector<int> vi;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };
const ll MOD = 1000000007;

signed main() {
  int X,Y;
  cin >> X >> Y;
  bool flag=false;
  for (int i = 0; i < X+1; i++) {
    if (2*i+4*(X-i)==Y) flag=true;
  }
  if(flag) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3580
class Dice{
	
public:
	Dice(int top, int front, int right,
		 int left, int back, int bottom);  //?????????????????????(?????°??????)
	
	void roll_n();
	void roll_e();
	void roll_s();
	void roll_w();
	int  get_top();  //top????????????(m_top)
	void show_all();
	
private:
	int m_top;
	int m_front;
	int m_right;
	int m_left;
	int m_back;
	int m_bottom;
};
#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> Dice_bec;

int main(void)
{
	Dice_bec dice_bec;
	int num;
	string rolling;
	
	for(int i = 0; i < 6; i++){
		cin >> num;
		dice_bec.push_back(num);
	}
	cin >> rolling;
	
	
	Dice dice(dice_bec[0], dice_bec[1], dice_bec[2],
			  dice_bec[3], dice_bec[4], dice_bec[5]);  //?????????????????????
			  
	
	for(int i = 0; i < rolling.size(); i++){
	
		switch(rolling[i]){
		case 'N' :
			 dice.roll_n();
			 break;
		case 'E' :
			 dice.roll_e();
			 break;
		case 'S' :
			 dice.roll_s();
			 break;
		case 'W' :
			 dice.roll_w();
			 break;
		}
	}
	
	cout << dice.get_top() << endl;
	//dice.show_all();
	
	return 0;
	
}
Dice::Dice(int top, int front, int right,      //?????????????????????
		   int left, int back, int bottom) :
		   m_top(top), m_front(front), m_right(right),
		   m_left(left), m_back(back), m_bottom(bottom)
{
	//	????????????
}

void Dice::roll_n()
{
	int temp = m_back;
	
	m_back   = m_top;
	m_top    = m_front;
	m_front  = m_bottom;
	m_bottom = temp;
	
}
void Dice::roll_e()
{
	int temp = m_top;
	
	m_top    = m_left;
	m_left   = m_bottom;
	m_bottom = m_right;
	m_right  = temp;
	
}

void Dice::roll_s()
{
	int temp = m_front;
	
	m_front  = m_top;
	m_top    = m_back;
	m_back   = m_bottom;
	m_bottom = temp;
}

void Dice::roll_w()
{
	int temp = m_left;
	
	m_left   = m_top;
	m_top    = m_right;
	m_right  = m_bottom;
	m_bottom = temp;
}

int Dice::get_top()
{
	return m_top;
}

void Dice::show_all()
{
	cout << m_top << ' '
		 << m_front << ' '
		 << m_right<< ' '
		 << m_left << ' '
		 << m_back << ' '
		 << m_bottom << ' ' << endl;
}

Measured memory_bytes: 3152
main(){char a[1010],b[1010];
       int i,k,c=0,f=10000;
 scanf("%s",a);scanf("%s",b);
 for(i=0;i<strlen(a)-strlen(b)+1;i++){
 for(k=0;k<strlen(b);k++){if(a[i+k]!=b[k])c++;}
   if(f>c)f=c;c=0;} 
  printf("%d",f);}


Measured memory_bytes: 1712
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) a[i] = scan.nextInt() - 1;
        int out = 0;
        for(int i = 0; i < n; i++){
            if(a[a[i]] == i) out++;
        }
        System.out.println(out / 2);
    }
    
    public static void main(String[] args){
        new Main().solve();
    }
}


Measured memory_bytes: 59564
#include <iostream>

using namespace std;

int main()
{
    int n; cin >> n;
    bool nothing = false;

    for (int i = 0; ;i++) {
        int sum = 4 * i;
        if (sum > n) {
            break;
        }
        for (int j = 0; ; j++) {
            sum += 7 * j;
            if (sum > n) {
                break;
            } else {
                if (sum == n) {
                    nothing = true;
                }
            }
        }
        if (nothing) {
            break;
        }
    }
    cout << (nothing ? "Yes" : "No") << endl;
    
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
const long long M =2e5+2,MOD=1e9+7;
typedef long long ll;
#define pb push_back
#define Y printf("YES\n")
#define N printf("NO\n")
#define O printf("-1\n")
bool f_2=false,vis[M]= {false},f=false;
vector<ll>v,v_1,v_2;
string s,p,q,ok,ch;
map<ll,ll>mp,mp_2;
set<ll>st,st_1;
ll arr[M],subtree[M]={0};
ll cnt=0,cost=0,mx=0,NODE,t,par,zero=0,pos=0,neg=0;
deque<ll>Q;
//vector< pair<ll,ll > >v,v_1;
struct node
{
    ll pa,ran,visit;

};
//node X[M];
int main()
{
    ios::sync_with_stdio(false);//ISHWAR
    cin.tie(0);//Tourist_Twin
    //freopen("kamona.txt","r",stdin);
    ll a,b,c,n,t,sum=0,mx=0,l,x,y,i=0,j=0,res,m,second=0,d,ans;
    cin>>n>>d;
    c=d*2;
    c++;
    d=c;
    while(1)
    {
        sum++;
        if(d>=n)
            break;
        d+=c;
    }

  cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
S = [0]*(N+1)
for n in range(N):
    S[n+1] = S[n] + A[n]
B = {}
for s in range(len(S)):
    B[S[s]] = 0
for s in range(len(S)):
    B[S[s]] += 1
res = 0
for v in B.values():
    if v > 1:
        res += v * (v - 1) // 2
print(res)

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

int main() {
  int n, d;
  cin >> n >> d;
  vector<vector<int>> h(n,vector<int>(d));
  rep(i,n) {
    rep(j,d) {
      cin >> h[i][j];
    }
  }
  
  int g = 0;
  rep(i,n) {
    for (int j=i+1; j<n; j++) {
      
      int a = 0;
      rep(k,d) {
        int diff = abs( h[i][k] - h[j][k] );
        a += diff * diff;
      }
      
      bool ok = false;
      for (int y=0; y*y<=a; y++)
        if (y*y == a) ok = true;
      
      if (ok) g++;
      
    }
  }
  
  cout << g << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 922337203685477;
const ll mininf = -922337203685477;
const ll nax = 1e5 + 5;
string s;
int n;

int main(){
	IOS
	cin >> n; 
	cin >> s;
	for(int i=0;i<s.length();i++){
		int x=s[i]-'A';
		x=(x+n)%26;
		s[i]=x+'A';
	}
	cout << s << '\n';
}


Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())



void init() {

}

void input() {

}

bool chk(string s, string t) {
  char c[26];
  REP(i, 26) c[i] = ' ';
  REP(i, SZ(s)) {
    int a = s[i]-'a';
    if (c[a] == ' ') c[a] = t[i];
    else {
      if (c[a] != t[i]) return false;
    }
  }
  return true;
}

void solve() {
  string s, t;
  cin >> s >> t;
  bool res = chk(s, t) && chk(t,s);
  if (res) cout << "Yes" <<endl;
  else cout << "No" << endl;
}

int main() {
	init();
	input();
	solve();
	return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    int ans = 0;
    for(int i = a; i <= b; i++) {
        string s = to_string(i);
        string r = to_string(i);
        reverse(r.begin(), r.end());
        if(s == r) ans++;
    }

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

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BalancedPath solver = new BalancedPath();
        solver.solve(1, in, out);
        out.close();
    }

    static class BalancedPath {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            // 2 * 80 * 80
            final int MAX = 13000;

            int h = in.nextInt();
            int w = in.nextInt();
            int[][] a = new int[h + 1][w + 1];
            int[][] b = new int[h + 1][w + 1];
            int[][] c = new int[h + 1][w + 1];
            boolean[][][] dp = new boolean[h + 1][w + 1][MAX + 1];

            for (int i = 1; i <= h; i++) {
                for (int j = 1; j <= w; j++) {
                    a[i][j] = Integer.parseInt(in.next());
                }
            }
            for (int i = 1; i <= h; i++) {
                for (int j = 1; j <= w; j++) {
                    b[i][j] = Integer.parseInt(in.next());
                }
            }
            for (int i = 1; i <= h; i++) {
                for (int j = 1; j <= w; j++) {
                    c[i][j] = Math.abs(a[i][j] - b[i][j]);
                }
            }

            dp[1][1][c[1][1]] = true;

            for (int i = 1; i <= h; i++) {
                for (int j = 1; j <= w; j++) {
                    for (int k = 0; k <= MAX; k++) {
                        if (dp[i][j][k]) {
                            if (i + 1 <= h) {
                                dp[i + 1][j][k + c[i + 1][j]] = true;
                                dp[i + 1][j][Math.abs(k - c[i + 1][j])] = true;
                            }
                            if (j + 1 <= w) {
                                dp[i][j + 1][k + c[i][j + 1]] = true;
                                dp[i][j + 1][Math.abs(k - c[i][j + 1])] = true;
                            }
                        }
                    }
                }
            }

            int result = Integer.MAX_VALUE;
            for (int k = 0; k <= MAX; k++) {
                if (dp[h][w][k]) {
                    result = Math.min(result, k);
                }
            }
            out.println(result);
        }

    }
}



Measured memory_bytes: 145652
class BinarySearchTree(object):
    __slots__ = ['root']

    def __init__(self):
        self.root = None

    def insert(self, key):
        new_node = [key, None, None]

        if self.root is None:
            self.root = new_node
            return

        parent, child = None, self.root
        while child:
            parent = child
            child = child[1] if key < child[0] else child[2]

        if key < parent[0]:
            parent[1] = new_node
        else:
            parent[2] = new_node

    def find(self, key):
        current = self.root
        while current and current[0] != key:
            current = current[1] if key < current[0] else current[2]

        return current

    def walk(self, walk_type):
        a = []
        self._walk(self.root, a, walk_type)
        return a

    def _walk(self, node, a, walk_type):
        if walk_type == 0:
            a.append(node[0])
        if node[1]:
            self._walk(node[1], a, walk_type)
        if walk_type == 1:
            a.append(node[0])
        if node[2]:
            self._walk(node[2], a, walk_type)


if __name__ == '__main__':
    import sys
    input()
    tree = BinarySearchTree()

    for cmd in (l.split() for l in sys.stdin):
        if cmd[0] == 'insert':
            tree.insert(int(cmd[1]))
        elif cmd[0] == 'find':
            print('yes' if tree.find(int(cmd[1])) else 'no')
        else:
            print('', *tree.walk(1))
            print('', *tree.walk(0))


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

int main() {
  int n,a,b,c,d;
  cin >> n;
  a=n/1000,b=n%1000/100,c=n%100/10,d=n%10;
  if (b==c && (a==b || c==d))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
	string s;
	cin >> s;
	ll sum=0;
	for(int i=0;i<s.length();i++){
		sum=sum+s[i]-'0';
	}
	if(sum%9==0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3344
#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.first << ' ' << p.second << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int,int>
#define MOD 1000003
#define zeros(x) x&(x-1)^x
#define fi first
#define se second
#define NMAX 405

long long s[NMAX], dp[NMAX][NMAX];

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

	int n;
	cin >> n;

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

		s[i] = s[i - 1] + x;
	}

	for(int dr = 1; dr <= n; ++dr)
		for(int st = dr - 1; st >= 1; --st)
			{
				dp[st][dr] = LLONG_MAX;
				for(int mid = st; mid < dr; ++mid)
					dp[st][dr] = min(dp[st][dr], dp[st][mid] + dp[mid + 1][dr] + s[dr] - s[st - 1]);
			}
	cout << dp[1][n] << '\n';
	return 0;
}

Measured memory_bytes: 1536
// B - Break Number
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	int maxN = 0;
	rp(i, 1, N+1){
		int n = i;
		int num = 1;
		while(n%2 == 0){
			num <<= 1;
			n /= 2;
		}
		maxN = max(maxN, num);
	}
	cout<< maxN <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <cmath>
#include <climits>
#include <cstdint>
using namespace std;

inline namespace atcoder {
    using i32 = int32_t; using u32 = uint32_t;
    using i64 = int64_t; using u64 = uint64_t;
    using f32 = float; using f64 = double;

    template <typename T, size_t Depth>
    struct vector_helper { using type = vector<typename vector_helper<T, Depth - 1>::type>; };
    template <typename T>
    struct vector_helper<T, 0> { using type = T; };
    template <typename T, size_t Depth>
    using vector_t = typename vector_helper<T, Depth>::type;

    template <typename T> using vec = vector_t<T, 1>;
    template <typename T> using vvec = vector_t<T, 2>;
    template <typename T> using vvvec = vector_t<T, 3>;
}

int main() {
    int a, b; cin >> a >> b;
    cout << max(a - b * 2, 0) << endl;
}



Measured memory_bytes: 3588
#include <iostream>

using namespace std;
int main(){
  int n;
  cin >> n;
  int s = 0;
  int tmp = n;
  while(tmp != 0){
    s += (tmp%10);
    tmp = tmp/10;
  }
  if(n%s == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
using namespace std;
map<string, int>mp; ll n; string a[114];
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n)mp[a[i]]++;
	for (auto x : mp) {
		if (x.second >= 2) {
			puts("No");
			return 0;
		}
	}
	rep(i, n - 1) {
		if (a[i][a[i].size() - 1] != a[i + 1][0]) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	getchar(); getchar(); return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
struct node{
	int to,nxt;
}edge[200100];
int cnt,head[100100],n,m,x,y,a,b,tot,degree[100100];
void addedge(int x,int y){
	edge[++cnt].nxt=head[x];
	edge[cnt].to=y;
	head[x]=cnt;
}
void dfs(int x,int las){
	if(x==a){
		puts("Yes");
		exit(0);
	}
	if(x==b)return;
	for(int i=head[x];i;i=edge[i].nxt){
		int upup=edge[i].to;
		if(upup==las)continue;
		dfs(upup,x);
	}
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&x,&y);
		addedge(x,y);
		addedge(y,x);
		degree[x]++,degree[y]++;
	}
	for(int i=1;i<=n;i++)
		if(degree[i]%2==1)return puts("No"),0;
	for(int i=1;i<=n;i++)
		if(degree[i]>=6)return puts("Yes"),0;
	for(int i=1;i<=n;i++)
		if(degree[i]==4){
			tot++;
			if(tot==1)a=i;
			if(tot==2)b=i;
			if(tot>=3)return puts("Yes"),0;
		}
	if(tot==0||tot==1)return puts("No"),0;
	for(int i=head[a];i;i=edge[i].nxt){
		int upup=edge[i].to;
		dfs(upup,a);
	}
	puts("No");
} 

Measured memory_bytes: 3328
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi; 
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_B() {}


int main_B() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int A, B, C; cin >> A >> B >> C;
    int X; cin >> X;

    int ans = 0;

    FOR(i,0,A+1){
        FOR(j,0,B+1){
            FOR(k,0,C+1) {
                if (500 * i + 100 * j + 50 * k == X) ans++;
            }
        }
    }

    cout << ans << endl;  

    return 0;
}

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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)

ll N;
vector<ll> A, X;

int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  cin >> N;
  A.resize(N);
  X.resize(N);
  for (ll i = 0; i < N; i++) cin >> A.at(i);
  ll s = 0;
  for (ll i = 0; i < N; i++) s += A.at(i);
  ll e = 0;
  for (ll i = 0; i < N-1; i += 2) e += A.at(i);
  X.at(N-1) = s/2 - e;
  X.at(0) = A.at(N-1) - X.at(N-1);
  for (ll i = 1; i < N-1; i++) X.at(i) = A.at(i-1) - X.at(i-1);
  for (ll i = 0; i < N; i++) {
    if (i > 0) cout << " ";
    cout << 2 * X.at(i);
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    ll a, b, c; cin >> a >> b >> c;
    if (a == b && b == c)
    {
        cout << ((a % 2 == 0) ? -1 : 0) << endl;
        return 0;
    }

    ll ans = 0;
    while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0)
    {
        ll ha = a / 2, hb = b / 2, hc = c / 2;
        a = hb + hc;
        b = hc + ha;
        c = ha + hb;
        ans++;
    }

    cout << ans << endl;
}


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

int main(){
    char c;
    cin>>c;
    cout<<(char)(c+1)<<endl;
}


Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const ll INF = 1e9 + 7;
#define PI 3.14159265359
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////


int main() {
	ll H; cin >> H;
	ll ans = 0;
	int key = 0;
	ll h = H;
	while (h != 0) {
		key++;
		h /= 2;
	}
	REP(i, key) {
		ans += pow(2, i);
	}
	cout << ans << endl;
	return 0;
}


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

const int N = 10;

int n, m;
char c[N][N];

void NO() {
	cout << "Impossible";
	exit(0);
}

void YES() {
	cout << "Possible";
	exit(0);
}

void go(int x, int y) {
	if (x == (n - 1) && y == (m - 1))
		YES();
	if (x >= n || y >= m)
		return;
	if (c[x + 1][y] == '#')
		go(x + 1, y);
	else if (c[x][y + 1] == '#')
		go(x, y + 1);
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m;
	int cnt = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++) {
			cin >> c[i][j];
			cnt += (c[i][j] == '#');
		}
	if (c[0][0] != '#' || c[n - 1][m - 1] != '#' || cnt != (n + m - 1))
		NO();
	go(0, 0);
	NO();
}


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

int main() {
  string s;
  cin >> s;
  int count = 700;
  if(s[0]== 'o') count+=100;
  if(s[1]== 'o') count+=100;
  if(s[2]== 'o') count+=100;
  cout << count << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int main() {
	int N, s, e, r;
	cin >> N;
	vector<int> A(N), B(N), D(N);
	rep(i, 0, N)cin >> A[i];
	rep(i, 0, N)cin >> B[i];
	rep(i, 0, N) {
		D[i] = A[i] - B[i];
	}
	sort(all(D));
	e = N - 1, s = 0;
	r = 0;
	while (D[s] < 0) {
		if (D[e] <= 0) {
			puts("-1");
			return 0;
		}
		r += D[e];
		e--;
		//printf("r:%d\n", r);
		while (D[s] < 0 && r + D[s] > 0) {
			//printf("r:%d\n", r);
			r += D[s];
			s++;
		}
	}
	printf("%d\n", N - e - 1 + s);
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(),v.end()

ll gcd(ll x, ll y)
{
    while (y > 0)
    {
        ll tmp = y;
        y = x % y;
        x = tmp;
    }
    return x;
}

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

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    cout << 800 * n - 200 * (n / 15) << endl;
}

Measured memory_bytes: 256
s = input()
counter = {}
flag = True

for i in s:
    if i not in counter:
        counter[i] = 1
    else:
        counter[i] += 1

for x, y in counter.items():
    if y != 2:
        flag = False
        break

if flag:
    print('Yes')
else:
    print("No")


Measured memory_bytes: 9040
def count_inner(P, x1, y1, x2, y2):
    cnt = 0
    for p in P:
        if x1 <= p[0] <= x2 and y1 <= p[1] <= y2:
            cnt += 1
    return cnt


def main():
    N, K = map(int, input().split())
    P = [None] * N
    xs = [0] * N
    ys = [0] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
        xs[i] = x
        ys[i] = y
    xs.sort()
    ys.sort()
    ans = float("inf")
    for i in range(N):
        for j in range(i+1, N):
            for k in range(N):
                for l in range(k+1, N):
                    if count_inner(P, xs[i], ys[k], xs[j], ys[l]) >= K:
                        ans = min(ans, (xs[j] - xs[i]) * (ys[l] - ys[k]))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 47964
#include<stdio.h>
#define N 3
int main(void)
{
 int a,b,c,tmp;
 int shiken[N] ={a,b,c};
 scanf("%d %d %d" , &a, &b, &c);
 if (a > b){
     tmp=a;
     a=b;
     b=tmp;
 }
 if (b > c){
     tmp=b;
     b=c;
     c=tmp;
 }
 if (a > b){
     tmp=a;
     a=b;
     b=tmp;
 }
     printf("%d %d %d\n", a, b, c);
 return 0;
}


Measured memory_bytes: 2092
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		while(true) {
			int n = sc.nextInt();

			if(n == 0) {
				break;
			}
			else {
				int []s = new int[n];
				double sum = 0;

				for(int i = 0; i < n; i++) {
					s[i] = sc.nextInt();
					sum += s[i];
				}
				
				double m = sum / n;
				double sumx = 0;

				for(int j = 0; j < n; j++) {
					sumx += Math.pow(s[j] - m, 2);
				}
				
				System.out.println(Math.sqrt(sumx / n));
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 31592
#include <iostream>

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    if(a < b){
        cout << "a < b" << endl;
    } else if(a == b){
        cout << "a == b" << endl;
    } else{
        cout << "a > b" << endl;
    }
    return 0;
}


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

using namespace std;

int main() {
	//入力
	int N;
	cin >> N;
	vector<int> A(N+2), S(N, 0);
	//原点の設定
	for (int i = 1; i < N+1; i++) cin >> A[i];
	A[0] = 0;
	A[N+1] = 0;

	int sum = 0;
	for (int i = 0; i < N+1; i++) sum += abs(A[i] - A[i + 1]);
	for (int i = 1; i < N + 1; i++) {
		S[i - 1] = sum + abs(A[i - 1] - A[i + 1]) - (abs(A[i] - A[i - 1]) + abs(A[i] - A[i + 1]));
		cout << S[i - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 2048
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(long long int*)a - *(long long int*)b;
}

int main(int argv, char *argc[]){
  unsigned char a;
  long long int N, M, K,A, B;
  long long int X[100000];
  long long int i, j;
  long long int location_coma[10000] = {0};
  long long int cnt = 0;
  scanf("%lld", &K);
  scanf("%lld", &A);
  scanf("%lld", &B);

  if (A >= B-1) {
    printf("%lld\n", K+1);
  }
  else {
    long long int cookie_num = 1;
      if (K < A) {
        printf("%lld\n", K+1);
      }
      else if (K >= A) {

        K = K - (A - 1);
        cookie_num = A;
        if (K%2 == 0) {
          cookie_num = A + (B-A)*(K/2);
        }
        else {
          cookie_num = A + (B-A)*(K/2) + 1;
        }
        printf("%lld\n", cookie_num);
      }
    

    
  }
  
  /* for (i = 1; i <= N; i += 2) { */
  /*   cnt++; */
  /*   /\* for (j = i; j <= N; j++) { *\/ */
  /*   /\*   if (abs(i-j) != 1 && i != j) { *\/ */
  /*   /\*     cnt++; *\/ */
  /*   /\*   } *\/ */
  /*   /\* } *\/ */

  /* } */
  /* if (cnt >= K) { */
  /*   puts("YES"); */
  /* }else { */
  /*   puts("NO"); */
  /* } */
  /* for (i = 0; i < M; i++) { */
  /*   scanf("%lld", &X[i]); */
  /* } */
 /*  qsort(X, M, sizeof(long long int), compare_int); */
 /*  long long int sum = 0; */
 /*  for (i = 0; i < M; i++) { */
 /*    printf("%lld, ", X[i]); */
 /*    //sum += L[i]; */
 /*  } */

 /*  location_coma[0] = X[0]; */
 /*  location_coma[N-1] = X[M-1]; */
 /*  printf("%lld, lld\n", location_coma[0], location_coma[N-1]); */
 /* for (i = 0; i < N; i++) { */
 /*    float pos = X[M-1] - X[0] / N; */
 /*      for (i = 0; i < M; i++) { */
        

 /*      } */
 /*  } */


  
  /* //qsort(L, N, sizeof(long long int), compare_int); */
  /* long long int sum = 0; */
  /* for (i = 0; i < N-1; i++) { */
  /*   //printf("%lld, ", L[i]); */
  /*   sum += L[i]; */
  /* } */
  /* if (sum > L[N-1]) { */
  /*   puts("Yes"); */
  /* } else { */
  /*   puts("No"); */
  /* } */
  return 0;
  /* scanf("%d", &X); */
  /* printf("%f\n", (float)T/X); */
  //a = 122;
  //printf("%lx\n",a);
  
}


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	
	HashMap<String, Integer> cache = new HashMap<String, Integer>();

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int numberOfPairs;
		numberOfPairs = input.nextInt();
		for(int i = 0; i < numberOfPairs; i++) {
			String firstString = input.next();
			String secondString = input.next();
			System.out.println(findLCS(firstString, secondString));
		}
		input.close();

	}
	
	static int findLCS(String s0, String s1) {
		int[][] table = new int[s0.length() + 1][s1.length() + 1];
		for(int i = 1; i < s0.length() + 1; i++) {
			for(int j = 1; j < s1.length() + 1; j++) {
				if(s0.charAt(i - 1) == s1.charAt(j - 1)) {
					table[i][j] = 1 + table[i - 1][j - 1];
				}
				else {
					table[i][j] = Math.max(table[i - 1][j], table[i][j - 1]);
				}
			}
			
		}
		return table[s0.length()][s1.length()];
		/* 
		 * Recursive Solution
		 * int length;
		if(cache.containsKey(s0 + "," + s1)) {
			return cache.get(s0 + "," + s1);
		}
		else if(cache.containsKey(s1 + "," + s0)) {
			return cache.get(s1 + "," + s0);
		}
		
		if(s0.isEmpty() || s1.isEmpty()) {
			length = 0;
			return length;
		}
		
		if(s0.charAt(0) == s1.charAt(0)) {
			length = 1 + findLCS(s0.substring(1), s1.substring(1));
			cache.put(s0 + "," + s1, length);
			return length;
		}
		else {
			length = Math.max(findLCS(s0.substring(1), s1), findLCS(s0, s1.substring(1)));
			return length;
			
		}
		*/
	}

}


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

int main() {
  int N, M; cin >> N >> M;
  if (N <= M){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}


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

using namespace std;

int main() {
    ll a[4], b[4], n;
    for (int i = 0; i < 4; i++) cin >> a[i];
    cin >> n;
    n <<= 2;
    int fac = 8;
    ll ans = 0;
    for (int i = 0; i < 4; i++) {
        int cur = fac;
        for (int j = i; j < 4; j++) {
            b[j - i] = a[j - i] * cur;
            cur >>= 1;
        }
        sort(b, b + (4 - i));
        ans += (n / fac) * b[0];
        n %= fac;
        fac >>= 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int ans = 1;
        for (int i = 0; i < n; i++) {
            ans = Math.min(ans * 2, ans + k);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll H, N;
    cin >> H >> N;
    ll total = 0;
    rep(i, N) {
        ll a;
        cin >> a;
        total += a;
    }
    if(total >= H) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    x = int(X/50)
    a = min(int(x/10),A) + 1 # 500 の個数
    b = min(int(x/2),B) + 1 # 100 の個数
    c = min(x,C) + 1 # 50 の個数

    ans = 0
    for i in range(a):
        for j in range(b):
            for k in range(c):
                num = i * 500 + j * 100 + k * 50
                #print(num)
                if num == X:
                    ans += 1
    print(ans)

Measured memory_bytes: 3064
import collections
def main():
    n = int(input())
    
    a_list = list(map(int, input().split()))

    c = collections.Counter(a_list)    

    ans = c.most_common(1)

    if ans[0][1] >= 2:
        print('NO')
    else:
        print('YES')

if __name__ == '__main__':
    main()



Measured memory_bytes: 33996
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <array>
#include <vector>

using namespace std;

int main() {

    int n;
    cin >> n;
    
    vector<int> ar;

    for (int i=0; i<n; i++) {
        int temp;
        cin >> temp;
        ar.push_back(temp);
    }

    sort(ar.begin(), ar.end());
    
    int answer =ar[ar.size()-1] -ar[0];
    
    if (answer < 0) {
        cout << -answer<< endl;
        
    }else {
        cout << answer << endl;
    }

    return 0;
}


Measured memory_bytes: 256
// AOJ 2109 Ancient Expression
// 2018.3.5 bal4u

#include <stdio.h>
#include <string.h>
#include <ctype.h>

int  G;
int  rank[128], ass[12];		// ass 0:left to right, 1:right to left
char gb[12][55], gw[12];

int  top, end;
char q[101], s[101];
char sp[101][202]; int len[101];

char buf[105], *p;
int in()
{
	int n = 0;
	while (*p >= '0') n = 10*n + (*p++ & 0xf); p++;
	return n;
}

void pushback(int min)
{
	int i, g;
	char op;
	
	if (!top) return;
	while (top && s[top-1] != '(') {
		op = s[top-1];
		if ((g = rank[op]) <= min) break;
		gb[g][gw[g]++] = op, top--;
	}
	for (g = G-1; g > min; g--) {
		if (!gw[g]) continue;
		if (ass[g]) for (i = 0; i < gw[g]; i++)    q[end++] = gb[g][i];
		else        for (i = gw[g]-1; i >= 0; i--) q[end++] = gb[g][i];
		gw[g] = 0;
	}
}

void parse()
{
	int g;

	p = buf, top = 0, end = 0;
	while (1) {
		if (*p <= ' ') { pushback(0); break; }
		if (isalpha(*p)) q[end++] = *p;
		else if (*p == ')') pushback(0), top--;
		else if (*p == '(') s[top++] = '(';
		else {
			g = rank[*p];
			if (ass[g]) pushback(g);
			else        pushback(g-1);
			s[top++] = *p;
		}
		p++;
	}
}

void cout()
{
	int s;
	char c, t[250];

	s = 0, top = 0;
	while (top < end) {
		if (isalpha(c=q[top])) sp[s][0] = c, sp[s][1] = 0, len[s] = 1;
		else {
			s -= 2; p = t;
			*p++ = '(', memcpy(p, sp[s  ], len[s  ]), p += len[s  ];
			*p++ = c,   memcpy(p, sp[s+1], len[s+1]), p += len[s+1];
			*p++ = ')', *p = 0;
			len[s] = p-t, memcpy(sp[s], t, p-t+1);
		}
		s++, top++;
	}
	puts(sp[0]);
}

int main()
{
	int M, N, g;
	int cno, cmax;

	fgets(p=buf, 10, stdin), cmax = in();
	for (cno = 0; cno < cmax; cno++) {
		if (cno) putchar('\n');

		fgets(p=buf, 10, stdin), G = in()+1;
		for (g = 1; g < G; g++) {
			fgets(p=buf, 100, stdin);
			ass[g] = (*p == 'R'), p+=2;
			M = in(); while (M--) rank[*p] = g, p+=2;
		}

		fgets(p=buf, 10, stdin), N = in();
		while (N--) {
			fgets(buf, sizeof(buf), stdin);
			parse();
			cout();
		}
	}
	return 0;
}


Measured memory_bytes: 2028
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
//https://qiita.com/ofutonfuton/items/92b1a6f4a7775f00b6ae
 
using namespace std;
typedef long long ll;
 
const ll M = 998244353;

ll euclid( ll a, ll b )
{
    ll temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

    if( a % b == 0 ) return b;
    return euclid( b, a % b );
}

int main()
{
    ll N, X;
    cin >> N >> X;
    ll* x = new ll[N];
    for(ll i = 0; i < N; i ++){
        cin >> x[i];
        x[i] -= X; 
        x[i] = abs(x[i]);
    }
    ll currentMax = abs(x[0]);
    
    for(ll i = 1; i < N; i ++){
        if(x[i] % currentMax != 0){
            currentMax = euclid(currentMax, x[i]);
        }    
    }

    cout << currentMax;
    
    return 0;
}

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

int main()
{
    int N, cnt = 0;
    string S;

    cin >> N >> S;

    for (int i = 0; i < 10; i++)
    {
        char c = '0' + i;
        for (int j = 0; j < N; j++)
        {
            if (S[j] == c)
            {
                for (int i2 = 0; i2 < 10; i2++)
                {
                    char c2 = '0' + i2;
                    for (int j2 = j + 1; j2 < N; j2++)
                    {
                        if (S[j2] == c2)
                        {
                            for (int i3 = 0; i3 < 10; i3++)
                            {
                                char c3 = '0' + i3;
                                for (int j3 = j2 + 1; j3 < N; j3++)
                                {
                                    if (S[j3] == c3)
                                    {
                                        cnt++;
                                        break;
                                    }
                                }
                            }
                            break;
                        }
                    }
                }
                break;
            }
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;

int main(int argc, char const *argv[]) {
    string S,ans;
    std::cin >> S;
    for (size_t i = 0; i < S.size()-8; i++) {
        ans.push_back(S[i]);
    }
    std::cout << ans << '\n';
  return 0;
}


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

int main(void){
   char str1[200001],str2[200001];
   int i,n,t=0;
   scanf("%s%s",str1,str2);

   n=strlen(str1);
   for(i=0;i<n;i++)
      if(str1[i]!=str2[i]) t++;


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

Measured memory_bytes: 2068
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      if(s[i]!=s[j]){
        i=j-1;
        break;
      }else{
        i=j;
      }
    }
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3776
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	int A[3];
	cin >> A[0] >> A[1] >> A[2];
	int ans = 1000;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (i == j || j == k || k == i) continue;
				int sum = 0;
				sum += abs(A[j] - A[i]) + abs(A[k] - A[j]);
				ans = min(ans, sum);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3576
//g++ t.cpp -o t && t < p.txt
//d>p.txt&&t<p.txt&&t2<p.txt

#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <ctime>
#include <bitset>

#define DB cerr<<"D"<<endl
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<ll,ll>;
const ll M = 998244353;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
ll mod_pow(ll x, ll a, ll m) { ll an = 1; while(a > 0) { if (a&1) an = an * x % m; x = x * x % m; a >>= 1;} return an;}
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
int keta(ll a) {int res=0; while(a>0) res+=a%10, a/=10; return res;}
const int up[]={1,-1,0,0}, lf[]={0,0,1,-1};
ll gcd(ll a, ll b) {if (b==0) return a; else return gcd(b, a%b);}

int main() {
  ll n,x,m; cin>>n>>x>>m;
  ll y = x;
  ll t[m];
  ll u[m]; fill(u,u+m,-1);
  ll sm = 0;
  for(ll i=0;i<n;i++) {
    if (u[y] != -1) {
      ll df = sm - u[y];
      ll lf = n - i;
      ll pt = i - t[y];
      sm += lf / pt * df;
      //cout << i << " " << n << " " << (lf%pt) << " " << n - (lf % pt) << endl;
      i = n - (lf % pt);
      //cout << sm << " " << df << " " << lf << " " << i << " " << pt<<endl;
      for(;i<n;i++) {
        sm += y; y = y*y%m;
      }
    } else {
      u[y] = sm; t[y] = i; sm += y;
      y = y*y%m;
    }
  }
  /*
  ll sm2 = 0; y = x;
  for(int i=0;i<n;i++) {
    cout << y << " ";
    sm2 += y; y = y*y%m;
  } cout<<endl;*/
  //cout<<endl;
  cout<<sm<<endl;
  //cout<<sm2<<endl;
}
// ・配列の大きさok？　・priority_queueはgreater？　・debug消した？
// ・落ち着いて。提出まで4分待ってね……WJ……1/10……2/10……

// Thank you for making problems and running the contest


Measured memory_bytes: 5152
s1 = list(input())
s2 = list(input())
n = len(s1)
m = len(s2)
dp = [[0]*(m+1) for _ in range(n+1)]
dp=[[0]*(m+1) for i in range(n+1)]

for i in range(1,n+1):
    for j in range(1,m+1):
        if s1[i-1]==s2[j-1]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
res=[]
i,j=n,m
while i> 0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        res.append(s1[i-1])
        i-=1
        j-=1
print("".join(res[::-1]))

Measured memory_bytes: 177288