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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1, 0};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    ll n;
    cin >> n;
    cout << n * (n-1) / 2 << "\n";
    return 0;
}

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

using namespace std;

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    vector<int>vec(5);
    vec={a,b,c};
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    
    for(int i=0;i<k;i++){
        vec.at(0)+=vec.at(0);
    }
    cout<<vec[0]+vec[1]+vec[2]<<endl;
}

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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	intl i,j,n;
	cin>>n;
	intl ans=0;
	for(i=1;i<=n;i++){
		j=n/i;
		j*=(j+1);
		j/=2;
		j*=i;
		ans+=j;
	}
	cout<<ans<<"\n";
}


Measured memory_bytes: 3608
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()

    if len(S) == 2:
        print(S)
    else:
        print(S[::-1])

if __name__ == '__main__':
    resolve()

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

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

	cin >> a >> b >> c;

	if (a == b) {
		if (b == c) {
			cout << "No";
		}
		else {
			cout << "Yes";
		}
	}
	else if(a == c){
		if (b == c) {
			cout << "No";
		}
		else {
			cout << "Yes";
		}
	}
	else {
		if (b == c) {
			cout << "Yes";
		}
		else {
			cout << "No";
		}
	}

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main
{

	public static void main(String[] args) 
	{
		Scanner scan = new Scanner(System.in);
		int value = scan.nextInt();
		int a = value;
		value = scan.nextInt();
		int b = value;
		System.out.println(String.format("%s %s", a*b,2*a+2*b));
	}

}



Measured memory_bytes: 26188
import sys
sys.setrecursionlimit(10**9)
n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
mod = 10**9+7
memo = [-1]*(n+1)
def rec(x):
    if memo[x] != -1: pass
    elif x == 0: memo[x] = 1
    elif a and x == a[-1]:
        memo[x] = 0
        a.pop()
    elif x == 1: memo[x] = 1
    else: memo[x] = (rec(x-1)+rec(x-2))%mod
    return memo[x]
print(rec(n))

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

#define int long long


signed main()
{
    int p, q, r=1;
    cin >> p >> q;
    q = q / __gcd(p, q);
    for(int i=2; i*i<=q; ++i) {
        if(q%i==0) {
            r *= i;
            while(q%i==0) q /= i;
        }
    }
    cout << r*q << endl;
    return 0;
}

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

#define ll long long
#define s(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)

int main()
{
    int t, i, j, ans=0;
    string s, s1;
    //cout << "Hello" << endl;
    cin >> s >> s1;
    t = s.size();
    for(i=0; i<t; i++){
        if(s[i]==s1[i])ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    string S;
    cin >> S;
    int sum = 0;
    vec<int> v;
    bool one = false;
    for(int i=0;i<N;i++){
        int n = S[i]-'0';
        int add = n;
        bool even = (N-1==(i | (N-i-1)));
        sum += add*even;
        sum %= 2;
        if(i!=N-1){
            int m = S[i+1]-'0';
            one |= abs(n-m)==1;
            v.push_back(abs(n-m));
        }
    }
    if(N<=100){
        vvec<int> dp(N,vec<int>(N,0));
        for(int i=0;i<N;i++){
            dp[0][i] = S[i]-'0';
        }
        for(int i=1;i<N;i++) for(int j=0;j<N-i;j++) dp[i][j] = abs(dp[i-1][j]-dp[i-1][j+1]);
        cout << dp[N-1][0] << "\n";
    }else{
        if(one) cout << sum%2 << "\n";
        else{
            sum = 0;
            for(int i=0;i<N-1;i++){
                int n = (v[i]==2? 1:0);
                int add = n;
                bool even = (N-2==(i| (N-i-2)));
                sum += add*even;
                sum %= 2;
            }
            cout << (sum%2? 2:0) << "\n";
        }
    }
//    for(int i=0;i<N;i++) for(int j=0;j<N;j++) cerr << dp[i][j] << (j!=N-1? " ":"\n");
}

Measured memory_bytes: 8216
from collections import deque
h,w=map(int,input().split())
s=[]
for _ in range(h):
    s.append(input())
ans=0        
sc=[[0 for i in range(w)] for j in range(h)]

for x in range(h):
    for y in range(w):
        if s[x][y]=='.' or sc[x][y]==1:
            continue
        path = deque([[x,y]])
        sc[x][y]=1
        b=1
        wh=0
        while len(path)>0:
            p = path.popleft()
            i,j=p[0],p[1]
            tc = '.' if s[i][j] == '#' else '#'
            point = b if s[i][j] == '#' else wh           
            if i > 0 and s[i-1][j]==tc and sc[i-1][j]==0:
                sc[i-1][j]=1
                path.append([i-1,j])
                if s[i-1][j] == '#':
                    b += 1
                else:
                    wh += 1
                ans += point
            if j > 0 and s[i][j-1]==tc and sc[i][j-1]==0:
                sc[i][j-1]=1
                path.append([i,j-1])
                if s[i][j-1] == '#':
                    b += 1
                else:
                    wh += 1
                ans += point
            if i < h-1 and s[i+1][j]==tc and sc[i+1][j]==0:
                sc[i+1][j]=1
                path.append([i+1,j])
                if s[i+1][j] == '#':
                    b += 1
                else:
                    wh += 1
                ans += point
            if j < w-1 and s[i][j+1]==tc and sc[i][j+1]==0:
                sc[i][j+1]=1
                path.append([i,j+1])
                if s[i][j+1] == '#':
                    b += 1
                else:
                    wh += 1
                ans += point
print(ans)

Measured memory_bytes: 4852
import sys
n,a,b,c=map(int,input().split())
s=[input() for i in range(n)]
ans=[]
for i in range(n-1):
  if s[i]=='AB':
    if a==0 and b==0:
      print('No')
      sys.exit()
    if a>b or (a==b and s[i+1]=='BC'):
      a-=1
      b+=1
      ans.append('B')
    else:
      a+=1
      b-=1
      ans.append('A')
  if s[i]=='BC':
    if b==0 and c==0:
      print('No')
      sys.exit()
    if b>c or (b==c and s[i+1]=='AC'):
      b-=1
      c+=1
      ans.append('C')
    else:
      b+=1
      c-=1
      ans.append('B')
  if s[i]=='AC':
    if a==0 and c==0:
      print('No')
      sys.exit()
    if a>c or (a==c and s[i+1]=='BC'):
      a-=1
      c+=1
      ans.append('C')
    else:
      a+=1
      c-=1
      ans.append('A')
for i in range(n-1,n):
  if s[i]=='AB':
    if a==0 and b==0:
      print('No')
      sys.exit()
    if a>=b:
      a-=1
      b+=1
      ans.append('B')
    else:
      a+=1
      b-=1
      ans.append('A')
  if s[i]=='BC':
    if b==0 and c==0:
      print('No')
      sys.exit()
    if b>=c:
      b-=1
      c+=1
      ans.append('C')
    else:
      b+=1
      c-=1
      ans.append('B')
  if s[i]=='AC':
    if a==0 and c==0:
      print('No')
      sys.exit()
    if a>=c:
      a-=1
      c+=1
      ans.append('C')
    else:
      a+=1
      c-=1
      ans.append('A')
print('Yes')
for i in range(n):
  print(ans[i])


Measured memory_bytes: 85696
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string s;
	cin>>n>>s;
	int cnt=0,ans=0;
	for(int i=0;i<n;i++)
		if(s[i]=='R')
			cnt++;
	for(int i=0;i<cnt;i++)
		if(s[i]=='W')
			ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3720
import java.math.*

fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    
    var TNum = 1L
    var ANum = 1L
    
    for (i in 1..N) {
        val (Ti, Ai) = readInputLine().split(" ").map { it.toLong() }
        var newTNum = TNum
        var newANum = ANum
        if (Ti == Ai) {
            // Ti = Ai = 1のパターン
            newTNum = Math.max(TNum, ANum)
            newANum = Math.max(TNum, ANum)
        } else if (Ti > Ai) {
            // Aiをベースに枚数を確定
            // ANum = ceil(ANum / Ai) * Ai
            newANum = (ANum / Ai + if (ANum % Ai != 0L) 1L else 0L) * Ai
            newTNum = newANum / Ai * Ti
        } else {
            // Tiをベースに枚数を決定
            newTNum = (TNum / Ti + if (TNum % Ti != 0L) 1L else 0L) * Ti
            newANum = newTNum / Ti * Ai
        }

        // 上記方法で推定した枚数が減少している場合は再計算
        if (newANum < ANum) {
            newANum = (ANum / Ai + if (ANum % Ai != 0L) 1L else 0L) * Ai
            newTNum = newANum / Ai * Ti
        }
        if (newTNum < TNum) {
            newTNum = (TNum / Ti + if (TNum % Ti != 0L) 1L else 0L) * Ti
            newANum = newTNum / Ti * Ai            
        }
        
        TNum = newTNum
        ANum = newANum
    }
    
    println(TNum + ANum)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 35948
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
 
int main() {
    int sum=15;
    int x1,x2,x3,x4,x5;
    cin>>x1>>x2>>x3>>x4>>x5;
    cout<<sum-(x1+x2+x3+x4+x5)<<endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int MAX = 100001;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // cout << fixed << setprecision(10);

    COMinit();
    
    int N, K; cin >> N >> K;
    vector<int> A(N);
    vector<int> max_n(N);
    rep(i, N) cin >> A[i];
    if (K <= 1) {
        cout << 0 << endl;
        return 0;
    }
    sort(A.begin(), A.end());

    // max Aiとなる回数を数える
    repr(i, K-1, N) {
        int n = i-1;
        int r = K-2;
        // cout << "n: " << n << " r: " << r << endl;
        max_n[i] = (max_n[i-1] + COM(n, r)) % MOD;
    }
    // rep(i, N) cout << max_n[i] << " ";
    // cout << endl;
    ll ans = 0;
    rep(i, N) {
        ans += (A[i] * ll(max_n[i]) - A[N-1-i] * ll(max_n[i])) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
#define str(n) to_string(n)
#define int(w) stoi(w)
#define len(l) l.size()
#define append(l,i) l.push_back(i)
int main() {
    int n,n1;
    cin>>n;
    vector<int> l;
    rep(i,n){
        cin>>n1;
        append(l,n1);
    }
    int cost=100000000;
    int cost1=0;
    for (int i=-100;i<101;i++){
        cost1=0;
        rep(j,n){
            cost1+=pow(l.at(j)-i,2);
        }
        if (cost1<cost){
            cost=cost1;
        }

        }
    cout<<cost<<endl;


    return 0;
}

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define fastIO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
int INPUT_INT() { int d; cin >> d; return d; } // 入力をpush_back(d)やarray[d]に使う時に無駄な変数を使わない

// ------------------- include, typedef, define END. -------------------

int main(){
	int n = 0, ans = 0;
	while (cin >> n)
		ans += n;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string a, b;
    cin >> a >> b;
    string s = a + b;
    int n = stoi(s);
    for(int i = 1; i * i <= n; i++){
        if(i * i == n){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;
	/*being john malkovich*/
	class Main
	{
		public static void main(String[] args)
		{
			long max = (long)(Math.pow(10,18));
			// System.out.println(max);
			Scanner s = new Scanner(System.in);
			long x = s.nextLong();
			long y = s.nextLong();

			/*
			if((x*2)%y!=0)
			{
				System.out.println(x*2);
			}
			else if((x*3)%y!=0)
			{
				System.out.println(x*3);
			}
			else
			{
				System.out.println("-1");
			}
			*/

			/*
			
			// else
			{
				int flag = 0;
				for(long i =1;i*x <= max;i++)
				{
					if((i*x)%y!=0)
					{
						flag = 1;
						System.out.println(i*x);		
						break;
					}
				}
				if(flag == 0)
					System.out.println("-1");
			}
			// */
			/*

			if(x!=y && x%y!=0)
			System.out.println(x*y + x);
			else if(x!=y && (x+1)%y!=0)
				System.out.println((x+1)*(y + 1));
			else
			System.out.println("-1");

			*/
			/*

			if(x!=y)
				System.out.println(x);
			else
				System.out.println("-1");
				*/

			/*
			if((x*2)%y!=0)
			{
				System.out.println(x*2);
			}
			else if((x*3)%y!=0)
			{
				System.out.println(x*3);
			}
			else if((x*4)%y!=0)
			{
				System.out.println(x*4);
			}
			else
			{
				System.out.println("-1");
			}
			// else if((x*5)%y!=0)
			{
				// System.out.println(x*5);
			}
			// else if((x*6)%y!=0)
			{
				// System.out.println(x*6);
			}
			*/
			/*
			if(x!=y)
			{
				if((x*(y+1))%y!=0  && (x*(y+1)) < max  )
					System.out.println((x*(y+1)));
				else
					System.out.println((x*(y/10+1)));
			}
			else
			{
				System.out.println("-1");
			}

			*/
			/*
			if(x!=y)
			{
				long val = (x*(y+1));
				if(val < max/10)
				{
					if(x%y!=0)
						System.out.println(val);
					else
						System.out.println((x+1)*(y+1));
				}
				else
				{
					val = (((x/10)*(y/10 + 1)));
					if(val%y!=0)
						System.out.println(val);
					else
						System.out.println((x/10+1)*(y/10+1));
				}
			}
			else
				System.out.println("-1");
				*/
				
				if(x!= y && x%y !=0 )
				{
					System.out.println(x*(y+1));
				}
				else
					System.out.println("-1");
					
		}

	}

Measured memory_bytes: 21972
#include<stdio.h>

int main()
{
	int n,key,i,j,k;
	int A[100];

	scanf("%d",&n);
	for( i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
	}
	for(j = 0;j < n;j++){
        key = A[j];
        i = j-1;
        for(i > 0;A[i] > key;i--){
            A[i+1] = A[i];
        }
        A[i+1] = key;
        for(k = 0;k < n;k++){
            printf("%d",A[k]);
            if(k < n-1){
                printf(" ");
            }else{
                printf("\n");
            }
        }
         
    }
return 0;
}

Measured memory_bytes: 604
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << "ABC" << n << endl;
	return 0;
}


Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

template<typename T> T mo(T x, T y) { x %= y; return x <= 0 ? x + y : x; }

const int MX = 100 * 1000 + 7;

int deg[MX];
vector<int> g[MX];
bool was[MX];
int timer = 1;
int tin[MX], fup[MX];

void dfs(int v, int p = -1) {
    was[v] = true;
    tin[v] = fup[v] = timer++;
    int c = 0;
    for (int to : g[v]) {
        if (to == p) {
            continue;
        }
        if (was[to]) {
            fup[v] = min(fup[v], tin[to]);
        } else {
            dfs(to, v);
            fup[v] = min(fup[v], fup[to]);
            if (fup[to] >= tin[v] && p != -1) {
                cout << "Yes\n";
                exit(0);
            }
            c++;
        }
    }
    if (p == -1 && c > 1) {
        cout << "Yes\n";
        exit(0);
    }
}

int main() {
#ifdef FASTIO
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
        deg[u]++;
        deg[v]++;
    }
    for (int i = 1; i <= n; i++) {
        if (deg[i] % 2) {
            cout << "No\n";
            return 0;
        }
    }
    int c4 = 0, c6 = 0;
    for (int i = 1; i <= n; i++) {
        if (deg[i] == 4) {
            c4++;
        }
        if (deg[i] >= 6) {
            c6++;
        }
    }

    if (c6) {
        cout << "Yes\n";
        return 0;
    }

    if (c4 < 2) {
        cout << "No\n";
        return 0;
    }

    if (c4 > 2) {
        cout << "Yes\n";
        return 0;
    }
    dfs(1);

    cout << "No\n";
    return 0;
}



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

int main() 
{
    	ios_base::sync_with_stdio(0);   cin.tie(0);     cout.tie(0);
    	string S, T;		cin >> S >> T;
    	set <int> s[26], t[26];
    	for(int i = 0; i < T.size(); i++)
    	{
    		s[S[i] - 'a'].insert(T[i] - 'a');
    		t[T[i] - 'a'].insert(S[i] - 'a');
    	}
    	for(int i = 0; i < 26; i++)
    		if(s[i].size() > 1)		return cout << "No", 0;	
    	for(int i = 0; i < 26; i++)
    		if(t[i].size() > 1)		return cout << "No", 0;	
    	cout << "Yes";
    	return 0;
}

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


int main(){
    int n;
    while(cin>>n,n){
        int cnt[26]={};
        vector<char> V(n);
        for(int i=0;i<n;i++){
            cin>>V[i];
        }
        bool flag=false;
        for(int i=1;i<=n;i++){
            char C=V[i-1];
            cnt[C-'A']++;
            int first=-1,second=-1;
            for(int c=0;c<26;c++){
                if(first==-1||cnt[c]>cnt[first]){
                    second=first;
                    first=c;
                }else if(second==-1||cnt[c]>cnt[second]){
                    second=c;
                }
            }
            if(cnt[first]>cnt[second]+n-i){
                flag=true;
                cout<<char('A'+first)<<' '<<i<<endl;
                break;
            }
        }
        if(!flag) cout<<"TIE"<<endl;
    }

    return 0;
}

Measured memory_bytes: 3124
a,b,k = map(int,input().split())
count = 0
if b >= a:
    count = a
    a = b
    b = count
ch = 1
for i in range(a,0,-1):
    if a % i == 0 and b % i == 0 and k == ch:
        print(i)
        break
    elif a % i == 0 and b % i == 0:
        ch += 1

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


int main(int argc, const char * argv[]) {
    
    while (true) {
        int n;
        cin >> n;
        if(n==0){
            break;
        }
        
        int count=0;
        while (true) {
            if(n == 1){
                break;
            }
            else if(n % 2 == 0){
                n /= 2;
            }
            else{
                n = 3*n + 1;
            }
            
            count++;
        }
        
        cout << count << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
n = int(input())
s = [str(input()) for _ in range(n)]

from collections import Counter
s = Counter(s).most_common()

b =[]
a = s[0][1]
for i in range(len(s)):
    if s[i][1] == a :
        b.append(s[i][0])
b= sorted(b)
for i in range(len(b)):
    print(b[i])

Measured memory_bytes: 45068
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int filler;
	for(int i = 1; i < 6; ++ i){
		cin >> filler;
		if(filler == 0){
			cout << i;
			break;
		}
	}
}

Measured memory_bytes: 3600
import java.io.InputStream

private val MOD = 1e9.toLong() + 7

val input = FastScanner()

fun main(args: Array<String>) = input.run {
    val n = nextInt()
    val m = nextInt()
    if (Math.abs(n - m) > 1) {
        println(0)
        return
    }
    var ans = 1L
    (1..n).forEach {
        ans *= it
        ans %= MOD
    }
    (1..m).forEach {
        ans *= it
        ans %= MOD
    }
    if (n == m) {
        ans *= 2
        ans %= MOD
    }
    println(ans)
}

class FastScanner(private val input: InputStream = System.`in`) {
    private val sb = StringBuilder()
    private val buffer = ByteArray(4096)
    private var pos = 0
    private var size = 0

    fun nextLong(): Long {
        var c = skipWhitespace()

        val sign = if (c == '-'.toInt()) {
            c = read()
            -1
        } else 1

        var ans = 0L

        while (c > ' '.toInt()) {
            ans = ans * 10 + c - '0'.toInt()
            c = read()
        }

        return sign * ans
    }

    fun nextInt() = nextLong().toInt()

    private fun skipWhitespace(): Int {
        while (true) {
            val c = read()
            if (c > ' '.toInt() || c < 0) return c
        }
    }

    private fun read(): Int {
        while (pos >= size) {
            if (size < 0) return -1
            size = input.read(buffer, 0, buffer.size)
            pos = 0
        }
        return buffer[pos++].toInt()
    }
}

Measured memory_bytes: 31392
#include<stdio.h>
#include<limits.h>
#include<stdlib.h>
typedef long long int lli;
int main(void)
{
    int  n;
    int a[2][100];
    int dp[3][101];

    scanf("%d",&n);
    for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
            scanf("%d",&a[i][j]);
        }
    }
    dp[0][0]=a[0][0];
    dp[1][0]=a[1][0]+dp[0][0];
    dp[0][1]=a[0][1]+dp[0][0];
    for(int i=0;i<2;i++){
        for(int j=1;j<n;j++){
            if(i==0)dp[i][j]=a[i][j]+dp[i][j-1];
            else{
                if(dp[i][j-1]+a[i][j]>dp[i-1][j]+a[i][j]){
                    dp[i][j]=dp[i][j-1]+a[i][j];
                }
                else{
                    dp[i][j]=dp[i-1][j]+a[i][j];
                }
            }
        }
    }
    printf("%d\n",dp[1][n-1]);
    return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

s = list(str(input()))

max_ = len(s)
for i in range(len(s)-1):
    if s[i] != s[i+1]:
        left = i+1
        right = len(s)-left
        # print(left, right)
        tmp = max(left, right)

        max_ = min(max_, tmp)
print(max_)


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

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


vector<vector<P> > g;

bool has_positive_cycle(int target,int pos,vector<int> flag,int cost){
	flag[pos]++;
	for (int i = 0; i < g[pos].size(); i++){
		int x = g[pos][i].first;
		if(x==target){
			return cost+g[pos][i].second>0;
		}
		if(flag[x]<0){
			return has_positive_cycle(target,x,flag,cost+g[pos][i].second);
		}
	}
	return false;
}

bool go_target(int target,int pos,vector<int> flag){
	flag[pos]++;
	for (int i = 0; i < g[pos].size(); i++){
		int x = g[pos][i].first;
		if(x==target){
			return true;
		}
		if(flag[x]<0){
			return go_target(target,x,flag);
		}
	}
	return false;
}




int main()
{
	int n,m,p;
	cin>>n>>m>>p;
	g.resize(n);
	for (int i = 0; i < m; i++){
		int a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		c = c-p;
		g[a].push_back(P(b,c));
	}

	// for (int i = 1; i < n-1; i++){
	// 	vector<int> flag1(n,-1),flag2(n,-1);
	// 	if(!go_target(i,0,flag1) || !go_target(i,n-1,flag2)){
	// 		for (int j = 0; j < g[i].size(); j++){
	// 			g[i][j].second= 0;
	// 		}
	// 	}
	// }

	// for (int i = 0; i < n; i++){
	// 	vector<int> flag(n,-1);
	// 	if(has_positive_cycle(i,i,flag,0)){
	// 		cout<<-1<<endl;
	// 		return 0;
	// 	}
	// }

	for (int i = 0; i < n; i++){
		for (int j = 0; j < g[i].size(); j++){
			g[i][j].second *= -1;
		}
	}
	int ret = 1e9;
	vector<int> dist(n,1e9);
	dist[0] = 0;
	for(int k = 0;k < n*2;k++){
		bool update = false;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < g[i].size(); j++){
				int to = g[i][j].first;
				int cost = g[i][j].second;
				if(dist[i]!=1e9 && dist[to] > dist[i] + cost){
					dist[to] = dist[i] + cost;
					update = true;
				}
			}
			if(update){
				// cout<<dist[n-1]<<endl;
				if(k>=n && dist[n-1]<ret){
					cout<<-1<<endl;
					return 0;
				}
				ret = dist[n-1];
				// break;
			}
		}
	}

	cout<<max(0,-1*dist[n-1]) << endl;


	return 0;
}

Measured memory_bytes: 512
/* 

	 - If you fail to prepare, you are prepared to fail.	

	(C) Mark Spitz

*/

#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define S second
#define F first
#define all(x) (x).begin(), (x).end()

using namespace std;

using ll = long long;

const bool dbg_flg = 1;
#define NAME(x) #x
#define debug if (dbg_flg) cerr
                                                      	
const int inf = 1e9 + 7;
const int MAXN = 2e5 + 5;

long double a, b, c;


void solve() {
	cin >> a >> b >> c;

	if (a + 2 * sqrt(a * b) + b < c) cout << "Yes";
	else cout << "No";
}


int main() {
	
	//~ freopen(".in", "r", stdin);
	//~ freopen(".out", "w", stdout);
	
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);

	int tt = 1;
	// cin >> tt;
	while (tt--) {
		solve();
	}

	return 0;
}

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

int main()
{
  char s[200]={};
   int i,j;
  int ans;
  
  scanf("%s",s);
  
  int l=strlen(s)-1;
 
 while(1)
 {
   int tmp=1;
  for(i=0;i<l/2;i++)
  {
    if(s[i]!=s[l/2+i])
    {
      tmp=0;
    }
  }
   
   if(tmp==1&&l%2==0)
   {
     break;
   }
   else
   {
     l--;
   }
 } 
  ans=l;
   printf("%d\n",ans);
   
   return 0;
 }
  

Measured memory_bytes: 128
S = input()
T = input()
max_a = -1
for i in range(len(S)-len(T)):
    a = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            a += 1
    if a > max_a:
        idx = i
        max_a = a
if len(S) == len(T):
    max_a = 0
    for i in range(len(S)):
        if S[i] == T[i]:
            max_a += 1
print(len(T) - max_a)

Measured memory_bytes: 67480
#include<stdio.h>
#include<algorithm>

int main() {
    int k;
    scanf("%d", &k);
    int s = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                s += std::__gcd(std::__gcd(a, b), c);
            }
        }
    }
    printf("%d\n", s);
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K;
    ll A[100010];
    cin >> N >> K;
    rep(i,0,N) cin >> A[i];
    sort(A, A+N);
    ll ans = 0;
    rrep(bit, 41, 0){
        // print2("bit",bit);
        ll cnt = 0;
        rep(i,0,N){
            if(A[i] < (1LL<<bit)) continue;
            if((A[i]>>bit) & 1) cnt++;
        }
        if(cnt <= N/2){
            if(ans + (1LL<<bit) <= K){
                ans += (1LL<<bit);
            }
        }
        // print(ans);
    }
    ll v = 0;
    rep(i,0,N){
        v += (A[i]^ans);
    }
    print(v);

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define V vector
#define L long
#define W V<L>
L E=70,M=2e17,i,a,b;W S(V<W>p){if(!E)return{1,0};V<V<W>>T(2);for(W x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1)T[(x[1])&1].push_back({x[0]/2,++x[1]/2});}for(L i;i<2;i++){L c=0;for(W x:T[!i])c^=(2*x[0]+x[1])%3+1;if(!c){E--;W A=S(T[i]);A[0]*=2;A[1]*=2;A[1]+=i;return A;}}for(W&v:p)v[0]++;W A=S(p);A[0]--;return A;}int main(){cin>>i;V<W>p(i);while(i--,cin>>a>>b)p[i]={a+M,b+M};W x=S(p);cout<<x[0]-M<<" "<<x[1]-M;}

Measured memory_bytes: 62908
#include<stdio.h>
int main(void)
{
  int a,b,x,y;
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&x);
  scanf("%d",&y);
  if(a == x){
    printf("%d",0);}
  else printf("%d",1);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>

using namespace std;

typedef pair<int,bool> Pair;

int main(){

  int A,B,C;
	
  cin >> A >> B >> C;
	
  A = A - B;

  if(C - A >= 0) cout << C - A << endl;
  else cout << "0" << endl;
	
  return 0;

}

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

struct Problem {
public:
	UL N;
	ULL A[200];
	string S;

	void Solve() {
		UL T; scanf("%u", &T);
		while (T--) {
			scanf("%u", &N);
			rep(i, N) scanf("%llu", &A[i]);
			cin >> S;
			reverse(S.begin(), S.end());
			reverse(A, A + N);
			UL ans = 0;
			rep(i, N) {
				if (S[i] == '0') {
					ULL d = ~(A[i] - 1) & A[i];
					for (UL j = i + 1; j < N; j++)
						if (A[j] & d) A[j] ^= A[i];
				}
				else {
					if (A[i]) {
						ans = 1;
					}
				}
			}
			printf("%u\n", ans);
		}
	}
};

int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

ll dp[3050][3050];

struct c{
	ll s;
	ll d;
};

int main(){
	int n, t; cin >> n >> t;
	vector<c> l(n);
	for( int i = 0; i < n; ++i ){
		cin >> l[i].s >> l[i].d;
	}
	sort(
		l.begin(), l.end(),
		[]( const c& x, const c& y ){
			return ( x.s == y.s ) ? ( x.d < y.d ) : ( x.s < y.s );
		}
	);
	ll ans = 0;
	for( int i = 0; i < n; ++i ){
		for( int x = 0; x < t; ++x ){
			dp[i+1][x] = dp[i][x];
		}
		for( int x = 0; x < t; ++x ){
			if( x+l[i].s < t ){
				dp[i+1][x+l[i].s] = max(
					dp[i+1][x+l[i].s], dp[i][x]+l[i].d
				);
			} else {
				ans = max( ans, dp[i][x]+l[i].d );
			}
		}
	}
	for( int x = 0; x < t; ++x ){
		ans = max( ans, dp[n][x] );
	}
	/*
	for( int i = 0; i <= n; ++i ){
		for( int x = 0; x < t; ++x ){
			cout << dp[i][x] << ' ';
		} cout << endl;
	}
	*/
	cout << ans << endl;
}

Measured memory_bytes: 71936
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int x;
    cin>>x;
    int ans=0;
    if(x<=599) ans=8;
    else if(x<=799) ans=7;
    else if(x<=999) ans=6;
    else if(x<=1199) ans=5;
    else if(x<=1399) ans=4;
    else if(x<=1599) ans=3;
    else if(x<=1799) ans=2;
    else ans=1;
    cout<<ans<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 3656
#include <stdio.h>
int main(void){
  int r,c;

  scanf("%d %d\n",&r,&c);
  int array[r+1][c+1];

  for(int i=0; i<=r; i++){
    for(int j=0; j<=c; j++){
      array[i][j] = 0;
    }
  }

  for(int i=0; i<r; i++){
    for(int j=0; j<c; j++){
      scanf("%d\n",&array[i][j]);
      array[r][j] += array[i][j];
      array[i][c] += array[i][j];
      array[r][c] += array[i][j];

    }
  }

  for(int i=0; i<=r; i++){
    for(int j=0; j<=c; j++){
      printf("%d",array[i][j]);
      if(j < c){
        printf(" ");
      }
    }
    printf("\n");
  }

  return 0;
}


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a == b + c || b == c + a || c == a + b) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <deque>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
   int x,a,b;
   cin >> x >> a >> b;
   string s;
   cout << (x-a)%b << endl;
    
}


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

if x <= 599:
    print(8)

elif x <= 799:
    print(7)

elif x <= 999:
    print(6)

elif x <= 1199:
    print(5)

elif x <= 1399:
    print(4)

elif x <= 1599:
    print(3)

elif x <= 1799:
    print(2)

elif x <= 1999:
    print(1)


Measured memory_bytes: 9172
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int N = fs.nextInt();
        int K = fs.nextInt();
        List<Integer> list = new ArrayList<>();

        for (int i = 0; i < N; ++i) {
            list.add(fs.nextInt());
        }
        Collections.sort(list);

        int ans = Integer.MAX_VALUE;
        for (int i = 0; i <= N-K; ++i) {
            ans = Math.min(ans, list.get(i+K-1) - list.get(i));
        }

        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}

    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }

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




Measured memory_bytes: 39476
#include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<time.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<fstream> 
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 #include<memory>
 
 using namespace std;

 int main()
 {
   string s;
   while(cin>>s)
   {
     string tmp="";
     int cnt=0;
     int point=0;
     int kk[100]={0};
     int i;
     for(i=0;i<s.length();i++)
     {
       if(s[i]=='A')
       { 
         cnt++;
         continue;
       }
       else
       {
         kk[point++]=cnt;
         tmp+=s[i];
         cnt=0;
         //cout<<tmp<<endl;
       }         
     } 
     kk[point++]=cnt;
     cnt=0;
     if(tmp!="KIHBR") cout<<"NO"<<endl;
     else
     {
       if(kk[1]==0&&kk[2]==0&&(kk[0]<=1&&kk[3]<=1&&kk[4]<=1&&kk[5]<=1))
       {
           cout<<"YES"<<endl;                                                              
       }    
       else cout<<"NO"<<endl;     
     }
   }
   return 0;
 }
 

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

int main(){
	#ifdef LOCAL
		freopen("in.txt","r",stdin);
		freopen("out.txt","w",stdout);
	#endif

	string str;
	cin >> str;
	bool ok = 0;
	for(int i = 0;i < str.size();i++){
		if(str[i] == '7') ok = 1;
	}

	if(ok) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  cin >> n;
  ll a[n];
  ll abs_max = 0;
  int am_idx = 0;
  for (int i=0; i<n; ++i) {
    cin >> a[i];
    if (abs(abs_max) < abs(a[i])) {
      abs_max = a[i];
      am_idx = i;
    }
  }
  cout << 2*n-1 << endl;
  for (int i=0; i<n; ++i) {
    cout << am_idx+1 << " " << i+1 << endl;
  }
  for (int i=1; i<n; ++i) {
    if (abs_max > 0) cout << i << " " << i+1 << endl;
    else cout << n-i+1 << " " << n-i << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	public K()
	{
		Solve();
	}
	void Solve()
	{
		var N = F();
		var a = G();
		var b = new List<int>(N);
		for (var i = N - 1; i >= 0; i -= 2) b.Add(a[i]);
		for (var i = N % 2; i < N; i += 2) b.Add(a[i]);
		WriteLine(string.Join(" ", b));
	}
}

Measured memory_bytes: 50488
h,w,k=map(int,input().split())
b=[input()for _ in range(h)]
ans=[w*[0]for _ in range(h)]
f=[1]*h
j=-1
bb=[]
for i in range(h):
  if "#"in b[i]:
    f[i]=0
    j=i
    if len(bb)==0:continue
    for k in bb:ans[k]=ans[j]
    bb=[]
  else:
    if j<0:bb.append(i)
    else:ans[i]=ans[j]
a=1
for i in range(h):
  if f[i]:continue
  fl=False
  for j in range(w):
    if b[i][j]=="#":
      if fl:a+=1
      fl=True
    ans[i][j]=a
  if fl:a+=1
for i in ans:print(*i)

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

using namespace std;

#define int long long
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cint int t;cin>>t;while(t--)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>

int32_t main(){
    int n;
    cin>>n;

    int a[n];
    int y=1;

    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2==0){
            if(a[i]%3==0) continue;
            if(a[i]%5==0) continue;
            else y=0;
        }
    }

    if(y){
        cout<<"APPROVED"<<endl;
    }else{
        cout<<"DENIED"<<endl;
    }
}

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

using namespace std;

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

int main(){
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if(u == s){
        cout << a - 1 << " " << b << endl;
    }else{
        cout << a << " " << b - 1 << endl;
    }
}


Measured memory_bytes: 256
n, m = map(int, input().split())

from collections import defaultdict
d = defaultdict(int)
for _ in range(n):
    A = list(map(int, input().split()))
    k, A = A[0], A[1:]
    for a in A:
        d[a] += 1

ans = 0
for v in d.values():
    if v == n:
        ans += 1
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define all(x) (x).begin(), (x).end()

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

    map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        sort(all(s));
        mp[s]++;
    }

    ll ans = 0;
    for (auto& p : mp) {
        int s = p.second;
        ans += (ll)s * (s - 1) / 2;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 11136
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf = 10**20
#########################
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    u,v,w = map(int,input().split())
    w = w%2
    edges[u-1].append((v-1,w));
    edges[v-1].append((u-1,w));
from collections import deque
queue = deque()
ans = [-1 for _ in range(N)]
queue.append(0)
ans[0] = 1
while len(queue) > 0:
    v = queue.popleft()
    for w,d in edges[v]:
        if ans[w] != -1:
            continue
        # print(w,d)
        ans[w] = (ans[v] + d) % 2
        # checked.add(w)
        queue.append(w)
for i in range(N):
    print(ans[i])

Measured memory_bytes: 38008
#include <bits/stdc++.h>
using namespace std;
int n;
double a;
double ans;
string s;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a>>s;
		if(s=="BTC")
			a*=380000;
		ans+=a;
	}
	printf("%.8lf\n",ans);
	return 0;
}

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

using namespace std;


int main(int argc, char *argv[])
{
    
    
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    string s,a;
    int cnt;
    bool match = false;
    
    getline(cin, s);
    getline(cin, a);
    
    for (int i = 0; i < s.length(); i++) {
        if (s[i] != a[0]) {
            continue;
        }
        cnt = 1;
        for (int j = 1; j < a.length(); j++) {
            if(s[(i+j)%(s.length())]!=a[j]) {
                break;
            }
            cnt++;
        }
        if (cnt == a.length()) {
            match = true;
            break;
        }
    }
    
    if (match) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 3240