akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  string S;cin>>S;
  string key="keyence";
  if(S==key){
    print("YES");
    return 0;
  }
  int size=S.size();

  REP(i,0,size+1){
    REP(j,i+1,size+1){
      string target=S.substr(0,i)+S.substr(j,size);
      if(target==key){
        print("YES");
        return 0;
      }
    }
  }

  print("NO");
  return 0;

}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
		private int totalVertex;
		private LinkedList<LinkedList<Integer>> adjList;
		//adjacency list of edges
		public Main() { 
			totalVertex = 0; 
		}
		public void loadAdjList() {
			Scanner in = new Scanner(System.in);
			totalVertex = in.nextInt();
			adjList = new LinkedList<LinkedList<Integer>>();
			for(int i = 0; i < totalVertex; i ++) {
				LinkedList<Integer> tmp = new LinkedList<Integer>();
				int idx1 = in.nextInt() - 1;//idx1 is basically i, so just use i 
				int degree = in.nextInt();
				//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
				for(int j = 0; j < degree; j ++) {
					int idx2 = in.nextInt() - 1;
					
					tmp.add(idx2);
				}	
				adjList.add(tmp);
			}
			in.close();
		}
		public int[] distance()
		{
			int[] visited = new int[totalVertex];
			int[] distance = new int[totalVertex];
			for(int i = 0; i < totalVertex ;i++)
			{
				distance[i] = -1 ;
			}
			ArrayList<Integer> toVisit = new ArrayList<Integer>();
			toVisit.add(0);
			distance[0] = 0;
			while(toVisit.size() > 0)
			{
				int v = toVisit.remove(0);
				visited[v] = 1;
				LinkedList<Integer> neighbors = adjList.get(v);
				for(int i = 0; i < neighbors.size() ; i++)
				{
					int v1 = neighbors.get(i);
					if(visited[v1] == 0 && toVisit.contains(v1) == false)
					{
						toVisit.add(v1);
						distance[v1] = distance[v] + 1;
						visited[v1] = 1;
					}
				}
			}
			return distance;
		}
		public static void main(String[] args)
		{
			Main erik = new Main();
			erik.loadAdjList();
			int[] dist = erik.distance();
			for(int i = 0 ; i < erik.totalVertex ; i++)
			{
				System.out.println( (i+1) + " " + dist[i]);
			}
		}	
	}
	


Measured memory_bytes: 28268
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner stdIn = new Scanner(System.in);
		while(true)
		{
			int n = stdIn.nextInt();
			int m = stdIn.nextInt();
			
			if(n==0 && m==0)
			{
				break;
			}
			
			int[] tarou = new int[n];
			int[] hanako = new int[m];
			int x = 0;
			int tarou_number = 0;
			int hanako_number = 0;
			int tarou_total = 0;
			int hanako_total = 0;
			
			for(int i=0;i<n;i++)
			{
				tarou[i] = stdIn.nextInt();
				tarou_total += tarou[i];
			}
			for(int i=0;i<m;i++)
			{
				hanako[i] = stdIn.nextInt();
				hanako_total += hanako[i];
			}
			
			if(Math.abs(tarou_total - hanako_total)%2==1)
			{
				System.out.println(-1);
			}
			else
			{
				Arrays.sort(tarou);
				Arrays.sort(hanako);
				for(int i=0;i<n;i++)
				{
				
				
					for(int j=0;j<m;j++)
					{
						int h = tarou[i];
						tarou[i] = hanako[j];
						hanako[j] = h;
						
						if(func(tarou)==func(hanako))
						{
							System.out.println(hanako[j]+" "+tarou[i]);
							x++;
							break;
						}
				
						h = tarou[i];
						tarou[i] = hanako[j];
						hanako[j] = h;
					}
					if(x!=0)
					{
						break;
					}
					if(i==n-1)
					{
						System.out.println(-1);
					}
				
				}
				
			}
			
		}
		
	}
	
	static int func(int[] x)
	{
		int total = 0;
		
		for(int i=0;i<x.length;i++)
		{
			total += x[i];
		}
		
		return total;
	}
	

}

Measured memory_bytes: 21044
#include<iostream>
#include<stdio.h>
#include<cctype>
using namespace std;
int main(){
    char ch;
    while(1){
        scanf("%c", &ch);
        if ( ch == '\n' ) break;
        else if(isalpha(ch)) {
            if (islower(ch)) printf("%c",toupper(ch));
            else printf("%c",tolower(ch));
        }
        else printf("%c",ch);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 3136
//Ash185-AtCoder:5 A - Calc [AtCoder Beginner Contest 172]
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define clock cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl; 
#define forie(a,n) for(int i=(a);i<=(n);i++)
#define forje(b,m) for(int j=(b);j<=(m);j++)
#define forke(c,g) for(int k=(c);k<=(g);k++)
#define ffe(a,n,b,m) forie(a,n) forje(b,m)
#define fori(n) for(int i=0;i<n;++i)
#define forj(n) for (int j=0;j<n;++j)
#define fork(n) for (int k=0;k<n;++k)
#define rev(s)  reverse(s.begin(), s.end()) 
#define mem(v,d) memset(v,d,sizeof(v))
#define ll long long
#define ull unsigned long long
#define re return 
using namespace std;
void Ash() 
{ 	
#ifndef ONLINE_JUDGE 
freopen("input.txt", "r", stdin); freopen("error.txt", "w", stderr); freopen("output.txt", "w", stdout); 
#endif 
}

void solve() { int a; cin >> a; cout << a + a*a + a*a*a << "\n"; }
 
int main() { fast; Ash(); solve(); clock; return 0; }  

Measured memory_bytes: 3800
#include<cstdio>
#include<cstring>
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<sstream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=100+10;
int a[5][5];
int main() {
    while(~scanf("%d%d%d",&a[1][1],&a[1][2],&a[1][3])){
        for(int i=2;i<=3;i++){
            for(int j=1;j<=3;j++)
                scanf("%d",&a[i][j]);
        }
        bool flag=1;
        for(int i=1;i<=2;i++){
            for(int j=i+1;j<=3;j++){
                int aa=a[j][1]-a[i][1],bb=a[1][j]-a[1][i];
                for(int k=2;k<=3;k++){
                    if(a[j][k]-a[i][k]!=aa) {flag=0;goto end;}
                    if(a[k][j]-a[k][i]!=bb) {flag=0;goto end;}
                }
            }
        }
        end:printf("%s\n",flag?"Yes":"No");
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int m,n,a,b,c,max;
	scanf("%d %d",&m,&n);
	a=m-n;
	b=m+n;
	c=m*n;
	max=a;
	if(max<b) max=b;
	if(max<c) max=c;
	printf("%d",max);
	return 0;
}

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

int main()
{
	int n;
	
	cin>>n;
	
	int h[n+1], i, maxv=0, t;
	
	for(i=1; i<=n; i++)
	{
	    cin>>h[i];
	}
	
	for(i=1; i<=n; i++)
	{
		if(h[i]>=maxv)
		{
			t++;
			maxv=h[i];
		}
	}
	
	cout<<t<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import numpy as np

N = int(input().strip())
A = list(map(int, input().strip().split(' ')))

A = np.asarray(A)
i = np.asarray([x for x in range(1, N+1)])
A = A - i

#b = np.round(np.median(A))
b = np.ceil(np.median(A))
A = A - b
A = np.absolute(A)
print(A.sum().astype(np.uint64))

Measured memory_bytes: 34184
//package AtCoder;
import java.io.*;
import java.util.*;

public class Main {
	static long dp(int i,int af,int bf,int cf)
	{
		if(i==n)
			return 0;
		if(dp[i][af][bf][cf]!=-1) return dp[i][af][bf][cf];
		
		long ans=0;
		if(af==0)
			ans=Math.max(ans, a[i]+dp(i+1,1,0,0));
		
		if(bf == 0)
			ans=Math.max(ans, b[i]+dp(i+1,0,1,0));
		
		if(cf == 0)
			ans=Math.max(ans, c[i]+dp(i+1,0,0,1));
			
		return dp[i][af][bf][cf] = ans;
	}
	static int n;
	static long[]a,b,c,dp[][][];
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter pw = new PrintWriter(System.out);
		n=sc.nextInt();
		a=new long[n];
		b=new long[n];
		c=new long[n];
		dp=new long[n][2][2][2];
		for(int i=0;i<n;i++)
		{
			a[i]=sc.nextLong();
			b[i]=sc.nextLong();
			c[i]=sc.nextLong();
			for(int j=0;j<2;j++)
				for(int k=0;k<2;k++)
					Arrays.fill(dp[i][j][k], -1);
		}
		System.out.println(dp(0,0,0,0));
		pw.close();
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() throws IOException {
			return br.readLine();
		}

		boolean hasnext() throws IOException {
			return br.ready();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] a = new Integer[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		char[] nextCharArray() throws IOException {
			return br.readLine().toCharArray();
		}

		public double[] nextDoubleArray(int n) throws IOException {
			double[] ans = new double[n];
			for (int i = 0; i < n; i++)
				ans[i] = nextDouble();
			return ans;
		}

	}
}


Measured memory_bytes: 88156
#include<iostream>
#include<math.h>

using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if (a <= 5) {
		cout << "0" << endl;
	}
	if (a >= 13) {
		cout << b << endl;
	}
	if (a >= 6) {
		if (a <= 12) {
			cout << b / 2 << endl;
		}
	}
    return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define M 1000000007
vector<ll> adj[200006];
ll vis[200006];


void dfs(ll node,vector<ll> &v)
{
  vis[node]=1;
  v.push_back(node);
  for(ll child:adj[node])
  {
    if(vis[child]==0)
      dfs(child,v);

  }
}


int main()
{

  #ifndef ONLINE_JUDGE


         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout); 

 #endif

  fastio; 

  ll n,m,u,v;
  cin>>n>>m;
  for (int i = 1; i <=n; ++i)
  {
    vis[i]=0;
    adj[i].clear();
  }
  while(m--)
  {
    cin>>u>>v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }

  ll res=INT_MIN;
  for (int i = 1;i<=n; ++i)
  {
    if(vis[i]==0)
    {
      vector<ll> v;
      dfs(i,v);
      res=max(res,(ll)v.size());
      v.clear();
    }
  }

  cout<<res;
  
return 0;   
}

Measured memory_bytes: 29944
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	int a, b, c;
	while(scanf("%d%d%d", &a, &b, &c)==3)
	{
		swap(a, b);
		swap(a, c);
		printf("%d %d %d\n", a, b, c);
	}
	return 0;
}


Measured memory_bytes: 128
# coding: utf-8

def is_mul_day(m, d):
    d1 = d % 10
    d10 = d // 10

    if d1 < 2 or d10 < 2:
        return False
    else:
        return m == d1*d10

M, D = list(map(int, input().split()))

res = 0
for i in range(1, M+1):
    for j in range(1, D+1):
        if is_mul_day(i, j):
            res += 1

print(res)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 100000000;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 998244353;
const ll maxn = 2000005;

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k,a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d); 
    while(1){
    	c-=b;
    	if(c<=0){
    		printf("Yes");
    		return 0; 
    	}
    	a-=d;
    	if(a<=0){
    		printf("No");
    		return 0; 
    	}
    	
    }
    
    return 0;
}




Measured memory_bytes: 3748
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

int f(int y, int m, int d) {
    if (m <= 2) y--, m += 12;
    return 365 * y + y / 4 - y / 100 + y / 400 + 153 * (m + 1) / 5 + d - 428;
}
int main() {
    int y1, m1, d1;
    int y2, m2, d2;
    while(1) {
        cin >> y1 >> m1 >> d1;
        cin >> y2 >> m2 >> d2;
        if(y1==-1) break;
        cout << f(y2, m2, d2) - f(y1, m1, d1) << endl;
    }
}

Measured memory_bytes: 3088
X, K, D = map(int, input().split())

if X - K * D >= 0:
    ans = abs(X - K * D)
elif X + K * D <= 0:
    ans = abs(X + K * D)
else:
    n = int(abs(X - K * D) / (2 * D))
    ans = min(abs(X - K * D + n * 2 * D), abs(X - K * D + (n + 1) * 2 * D))
    
print(ans)

Measured memory_bytes: 9124
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=[-i for i in a]
heapq.heapify(a)
for _ in range(m):
    mm=heapq.heappop(a) #最小値(元のaの最大値)を取り出す
    heapq.heappush(a,(-1)*(-mm//2)) #Pythonでは -11//2=6になってしまう
print(-sum(a))

Measured memory_bytes: 14180
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int M = Integer.parseInt(tokens[1]);

		// 正解した場合の時間
		long result = 1900 * M + 100 * (N - M);
		// 全部正解する確率
		long ratio = 2;
		for (int i = 2; i <= M; ++i) {
			ratio *= 2;
		}
		result *= ratio;
		System.out.println(result);
	}
}


Measured memory_bytes: 21072
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;

int main ()
{
    long long int n,i,k,ans=0;
    cin >> n >>k;
    for (i = k ; i <= n+1; i++)
    {
        ans += i*(n-i+1) +1;
    }
    cout << ans%mod << endl;
    return 0;
}


Measured memory_bytes: 3544
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {

    ios:: sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int x, n;
    cin >> x >> n;
    unordered_set <int> s;
    for (int i = 0; i < n; ++i) {
        int k;
        cin >> k;
        s.insert(k);
    }
    int index;
    int minsf = INT_MAX;
    for (int i = x; i >= -1000; --i) {
        if (s.count(i) == 0) {
            if (minsf > abs(x - i)) {
                minsf = abs(x - i);
                index = i;
                break;
            }
        }
    }
    for (int i = x; i <= 1000; ++i) {
        if (s.count(i) == 0) {
            if (minsf > abs(x - i)) {
                minsf = abs(x - i);
                index = i;
                break;
            }
        }
    }
    cout << index << endl;
}

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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)
//ユークリッドの互除法
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}
ll warikid(ll mx,ll a,ll b){
    ll g=gcd(a,b);
    return mx-(mx/a+mx/b-mx/(a*b/g));
}


int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    ll A,B,C,D;
    cin >>A>>B>>C>>D;

    //-----------------------------------


    cout << warikid(B,C,D)-warikid(A-1,C,D) <<endl;
    return (0);
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var a int
	fmt.Scan(&a)
	sts := make([]string, a)
	for i := 0; i < a; i++ {
		fmt.Scan(&sts[i])
	}
	var total float64
	for i := 0; i < a; i++ {
		v := sts[i]
		n, _ := strconv.ParseFloat(v, 64)
		var x float64
		x = 1 / n
		total = total + x
	}

	var ans float64
	ans = 1 / total
	fmt.Println(ans)
}


Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		bool[][][] forbid = new bool[N+1][][];
		for(int i=0;i<N+1;i++){
			forbid[i] = new bool[N+1][];
			for(int j=0;j<N+1;j++){
				forbid[i][j] = new bool[N+1];
			}
		}
		
		for(int k=0;k<M;k++){
			int r = R[k];
			int l = L[k];
			int x = X[k];
			for(int i=0;i<r;i++){
				for(int j=0;j<r;j++){
					int cnt = 1;
					if(l <= i) cnt++;
					if(l <= j) cnt++;
					if(cnt != x){
						forbid[r][i][j] = true;
						forbid[r][j][i] = true;
						forbid[i][r][j] = true;
						forbid[i][j][r] = true;
						forbid[j][i][r] = true;
						forbid[j][r][i] = true;
					}
				}
			}
		}
		
		int mod = (int)1e9 + 7;
		int[][][] dp = new int[N+1][][];
		for(int i=0;i<N+1;i++){
			dp[i] = new int[N+1][];
			for(int j=0;j<N+1;j++){
				dp[i][j] = new int[N+1];
			}
		}
		
		dp[0][0][0] = 1;
		for(int i=0;i<=N;i++){
			for(int j=0;j<=N;j++){
				for(int k=0;k<=N;k++){
					
					if(forbid[i][j][k]){
						dp[i][j][k] = 0;
						continue;
					}
					int nxt = 1 + Math.Max(Math.Max(i, j), k);
					if(nxt > N) continue;
					dp[nxt][j][k] += dp[i][j][k]; if(dp[nxt][j][k] >= mod) dp[nxt][j][k] -= mod;
					dp[i][nxt][k] += dp[i][j][k]; if(dp[i][nxt][k] >= mod) dp[i][nxt][k] -= mod;
					dp[i][j][nxt] += dp[i][j][k]; if(dp[i][j][nxt] >= mod) dp[i][j][nxt] -= mod;
				}
			}
		}
		
		int tot = 0;
		for(int i=0;i<N;i++){
			for(int j=0;j<N;j++){
				tot += dp[i][j][N]; if(tot >= mod) tot -= mod;
				tot += dp[i][N][j]; if(tot >= mod) tot -= mod;
				tot += dp[N][i][j]; if(tot >= mod) tot -= mod;
			}
		}
		Console.WriteLine(tot);
		
	}
	int N, M;
	int[] L,R,X;
	public Sol(){
		var d = ria();
		N = d[0]; M = d[1];
		L = new int[M];
		R = new int[M];
		X = new int[M];
		for(int i=0;i<M;i++){
			d = ria();
			L[i] = d[0]; R[i] = d[1]; X[i] = d[2];
		
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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


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

  bool ans = false;
  for(int i=1;i<10;i++){
    if(N%i == 0 && N/i < 10){
      ans = true;
      break;
    }
  }

  if(ans == true){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}

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

int main(){
    string S;
    cin >> S;
    int ans0 = 0;
    int ans1 = 0;
    bool is_reversed = false;
    for (char c : S){
        if (!is_reversed){
            if (c == '0'){
                ans0 += 1;
            }else{
                ans1 += 1;
            }
        }else{
            if(c == '1'){
                ans0 += 1;
            }else{
                ans1 += 1;
            }
        }
        is_reversed = !is_reversed;
    }
    cout << min(ans0, ans1) << endl;
    return 0;
}

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

int main()
{
	string s, t;
	while (cin >> s) {
		cin >> t;
		int n = s.size(), m = t.size(), res = 0;
		vector<vector<int>> dp(n + 1, vector<int>(m + 1));
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (s[i] == t[j]) {
					dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
					res = max(res, dp[i + 1][j + 1]);
				}
			}
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 65328
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

set<int> s;
int main() {
  for(int n; cin >> n && n;) {
    s.clear();
    while(n!=1) {
      s.insert(n);
      if(n%2) n=n*3+1;
      else n/=2;
    }
    pr(s.size());
  }
  return 0;
}


Measured memory_bytes: 1192
#include <iostream>
int main(){
  int n,t,a=0,i,c[100001]={},inf=1e9+7;
  bool f=true;
  for(std::cin>>n,i=0;i<n;++i){std::cin>>t;++c[t];}
  for(i=0;i<(n+1)/2;++i){
    if(n%2){if(c[2*i]!=(i==0?1:2)){f=false;break;}}
    else if(c[2*i+1]!=2){f=false;break;}
  }
  if(f){
    a=1;
    for(i=0;i<n/2;++i)a=(a*2)%inf;
  }
  std::cout<<a<<"\n";
}

Measured memory_bytes: 640
import itertools

def main():
    n,w = [int(i) for i in input().split()]
    vals = [[], [], [], []]

    w0, v0 = [int(i) for i in input().split()]
    vals[0].append(v0)

    for i in range(n - 1):
        wi, vi = [int(i) for i in input().split()]
        vals[wi-w0].append(vi)

    vals[0].sort(reverse=True)
    vals[1].sort(reverse=True)
    vals[2].sort(reverse=True)
    vals[3].sort(reverse=True)

    ans = 0
    for i, j, k, l in itertools.product(range(len(vals[0])+1), range(len(vals[1])+1), range(len(vals[2])+1), range(len(vals[3])+1)):
        if i * w0 + j * (w0 + 1) + k * (w0 + 2) + l * (w0 + 3) <= w:
            ans = max(ans, sum(vals[0][:i]) + sum(vals[1][:j]) + sum(vals[2][:k]) + sum(vals[3][:l]))

    print(ans)

main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb push_back
#define eb pb
#define rep(X,Y) for(int X=0;X<(Y);++X)
#define all(X) (X).begin(),(X).end()

using namespace std;
using ll=long long;

int main(){
	double a,b;
	cin>>a>>b;
	a=b=max(a,b);
	double re=a*a*3.14159265358979*b/3;
	cout<<fixed<<setprecision(10)<<re*4<<endl;
}



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

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

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    for(auto &a:A) cin>>a;
    sort(A.begin(), A.end());
    int g=A[0];
    for(int i=1;i<N;i++){
        g=gcd(A[i],g);
    }
    cout<<g<<endl;
    return 0;
}

Measured memory_bytes: 640
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

X,Y,Z = LI()

print(Z,X,Y)

Measured memory_bytes: 38384
#include <cstdio>
#include <vector>
#include <cmath>
#include <complex>
#include <iostream>
using namespace std;

#define EPS 1e-6

typedef long double ldouble;
typedef complex<ldouble> P;

ldouble cross(const P &a, const P &b){
	return real(a) * imag(b) - imag(a) * real(b);
}

int n;
P z[10001];
ldouble Vabs;

const ldouble g = 9.8;

P jump(int &i){
	P dir = z[i] - z[i-1];
	P v = Vabs / abs(dir) * dir;
	const P &base = z[i];
	ldouble a = g / (real(v) * real(v) * 2.0);
	ldouble b = imag(v) / real(v);

	for(int j = i; j < n - 1; ++j){
		P z1 = z[j] - base;
		P z2 = z[j+1] - base;
		ldouble c = imag(z2 - z1) / real(z2 - z1);
		ldouble d = imag(z1) - c * real(z1);
		ldouble e = sqrt((b-c) * (b-c) - 4.0 * a * d);

		ldouble x = (b - c + e) / (2.0 * a);
		if(x > real(z1) && x < real(z2)){
			ldouble y = -a * x * x + b * x;
			i = j;
			return P(x, y) + base;
		}
	}

	i = n;
	return z[n-1];
}

int main(){
	ldouble x, y;
	cin >> n >> Vabs;
	for(int i = 0; i < n; ++i){
		cin >> x >> y;
		z[i] = P(x, y);
	}

	ldouble ans = 0.0;
	P prev = z[0];
	for(int i = 1; i < n; ++i){
		P dif = z[i] - prev;
		ans += abs(dif);
		if(i == n - 1) break;

		if(cross(dif, z[i+1] - z[i]) < -EPS){
			prev = jump(i);
		}
		else{
			prev = z[i];
		}
	}
	
	printf("%.20f\n", (double)ans);
}

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    int s=0;
    for(int i=0;i<k;i++)
        s+=a[i];
    cout<<s;

}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const int MOD=1e9+7;
const int N=1e9+5;

int main(){
    vi x(5);
    for(auto &y: x) cin >> y;
    for(int i=0; i<5; i++){
        if(x[i] == 0) cout << i+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	string s;
	cin >> s;
	s.at(3) = '8';
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
v = list(map(int ,input().split()))

o = Counter(v[::2]).most_common() # 偶数列の最頻値の順に並べる
e = Counter(v[1::2]).most_common() # 奇数列の最頻値の順に並べる

if o[0][0] == e[0][0]: # 最頻値が偶数列と奇数列で同じかどうか判定
  if len(o) == 1: print(n//2) # 値のバリエーションが最頻値のみの場合は片方の数列を書き換えて終わり
  else:
    # 最終的に数列上に残る値の種類は2種類のみの為、上位2種の値へ全て揃える
    # 下記の2パターンで書き換える数が少ない方が回答になる
    o1,o2 = e[0][1], e[1][1]
    e1,e2 = o[0][1], o[1][1]
    
    ans = min(n-e1-o2, n-e2-o1)
    print(ans)
else:
  print(n - o[0][1] - e[0][1]) #最頻値が異なる場合は、全体の数からそれぞれの最頻値の数を引く

Measured memory_bytes: 25252
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
mod = 1000000007

i = 0
sum = 0
each_sum = 0
while i < n-1
  each_sum += arr[i]
  sum += arr[i+1] * each_sum 
  # p "i:#{i}, each_sum:#{each_sum}, sum:#{sum}"
  i += 1
end
p sum%mod

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

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

Measured memory_bytes: 256
def main():
    N = int(input())
    S = input()
    T = input()
    if S == T:
        return print(len(S))
    ans = len(S) + len(T)
    if len(S) > len(T):
        for i in range(len(S) - len(T), len(S)):
            if S[i:] == T[:len(S[i:])]:
                ans -= len(S[i:])
                break
    else:
        for i in range(len(S), 0, -1):
            if T[:i] == S[len(S) - i:]:
                ans -= i
                break
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

// UnionFind
class UnionFind {
private:
    vector<int> par;
public:
    UnionFind(int n) {
        par.resize(n, -1);
    }

    int root(int x) {
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    bool unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return false;
        if (size(rx) < size(ry)) swap(rx, ry);
        par[rx] += par[ry];
        par[ry] = rx;
        return true;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int n, q; cin >> n >> q;
    UnionFind uni(n);
    REP(i, q) {
        int p,a,b; cin >> p >> a >> b;
        if (p == 0) {
            uni.unite(a, b);
        }
        else {
            if (uni.same(a, b)) {
                puts("1");
            }
            else {
                puts("0");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
    using namespace std;
  #define int long long int
    #define endl "\n"
    #define MOD 1000000007
    #define mod 1000000007
    #define M 1000000007
    
    #define pb push_back
    #define take(a,b,c) for(int b=0;b<c;b++) cin>>a[b]
  //  #define mp make_pair
  #define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);  
  #define mx 400005
  #define fiint(a,b) memset(a,b,sizeof(a))  
  #define bitcount __builtin_popcount
  #define fori(i,a,b) for(int i=a;i<b;i++)
  #define ford(i,a,b) for(int i=a;i>=b;i--)
  #define debug(x) cout<<x<<endl;
  #define cases(t) int t; cin>>t; while(t--)
  #define inf1 INT_MAX
  #define all(a) a.begin(),a.end()
  #define vec vector<int>
  #define pii pair<int,int>
  #define plii pair<int,int>
  #define pint pair<int,int>
  #define ff first
  #define ss second
  #define lb lower_bound
  #define ub upper_bound
  #define bs binary_search
  #define sz(x) (int)x.size()
#define PI                    3.14159265359

bool prime[10000001];

void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}

void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}

void sub_self(int& a, int b) {
    a -= b;
    if(a < 0) {
        a += mod;
    }
}

signed  main() 
{ 
	int n;cin>>n;
	vec v(n+1);
	fori(i,1,n+1)cin>>v[i];
	vector<vec> dp(n+1 , vector<int>(n + 1)  );
	for(int l = n ; l >=1 ; l-- )
		for(int r =l ;r<=n ;r++)
			{
				if(l==r)
					dp[l][r]=0;
				else 
				{
					int sum=0;
					fori(i,l,r+1)
						sum+=v[i];
						dp[l][r] = 1e18L + 5;
					for(int mid = l;mid <r ; mid++  )
						dp[l][r] = min(dp[l][r],dp[l][mid] + dp[mid+1][r] + sum);


				}
			}

			cout<<dp[1][n]<<endl;	


}

 


Measured memory_bytes: 1536
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        long[] a = sc.nextLongArray(n);
        long[] ans = new long[n];
        long now = 0;
        for(int i = 0; i < n; i++){
            if(i % 2 == 0){
                now += a[i];
            }else{
                now -= a[i];
            }
        }
        ans[0] = now;
        for(int i = 0; i < n-1; i++){
            ans[i+1] = 2*a[i] - ans[i];
        }
        for(long aa : ans){
            System.out.print(aa + " ");
        }
        
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
    
    public double[] nextDoubleArray(int n) {
        double[] a = new double[n];
        for (int i = 0; i < n; i++)
            a[i] = nextDouble();
        return a;
    } 
}


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

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


int main()
{
    int n;
    scanf("%d", &n);
    int d[n];
    for(int i=0;i<n;i++){
        scanf("%d", &d[i]);
    }
    qsort(d, n, sizeof(int), compare_int);
    int res=0,max=0;
    for(int i=0;i<n;i++){
        if(max<d[i]){
            max=d[i];
            res++;
        }
    }
    printf("%d\n", res);
    return 0;
}


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

typedef std::pair <int, int> pr;
const int N = 200054;

int X, Y, n, m = 0;
int stack[N];
pr a[N];

inline int proj(int x, int y) {
	return	!y ? x :
			x == X ? X + y :
			y == Y ? X + Y + X - x :
			!x ? X + Y + X + Y - y : -1;
}

int main() {
	int i, top = 0, x1, y1, p1, x2, y2, p2;
	scanf("%d%d%d", &X, &Y, &n);
	for (i = 0; i < n; ++i) {
		scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
		p1 = proj(x1, y1), p2 = proj(x2, y2);
		if (~p1 && ~p2) a[m++] = pr(p1, i), a[m++] = pr(p2, i);
	}
	std::sort(a, a + m);
	for (i = 0; i < m; ++i) top && a[i].second == stack[top - 1] ? --top : stack[top++] = a[i].second;
	return puts(top ? "NO" : "YES"), 0;
}

Measured memory_bytes: 2176
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}
	
	else if(a>b){
		printf("a > b\n");
	}
	
	else{
		printf("a == b\n");
	}
	return 0;
}


Measured memory_bytes: 2688
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve(){
  char a;
  cin>>a;
  if(a<='Z' && a>='A')cout<<'A';
  else cout<<'a';
}
signed main(){
		ios_base::sync_with_stdio(0);cin.tie(0);
    int T=1;
    //cin>>T;
    while(T--)solve();
}

Measured memory_bytes: 3612
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <fstream>
#include <cassert>

using namespace std;

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define RFOR(i, b, a) for(int i = b - 1; i >= a; --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)

#define ALL(V) V.begin(), V.end()
#define SIZE(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define EPS 1e-7
#define Pi 3.14159265358979
#define FILL(a,v) memset(a,v,sizeof(a))

using namespace std;


typedef long long Long;
typedef unsigned long long ULong;
typedef unsigned int Uint;
typedef unsigned char Uchar;
typedef vector <int> VI;
typedef pair <int, int> PII;




int main() {
    ios_base::sync_with_stdio(false);

    Long n;

    cin >> n;

    FOR(a,1,3600)
        FOR(b,1,3600) {
        Long left = 4*a*b - n*b - n*a;
        Long right = n*a*b;
        if (left > 0 && right % left == 0) {
            cout << a<< " " << b << " " << right/left << endl;
            return 0;
        }
    }


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n,r[200000],max,i,j,min;

  scanf("%d",&n);
  while(n<2||n>200000)  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&r[i]);
  }

  max=r[1]-r[0];
  min=r[0];
  for(j=1;j<n;j++){
      if((r[j]-min)>max) max=r[j]-min;
      if(min>r[j])min=r[j];
  }
  printf("%d\n",max);

  return 0;
}



Measured memory_bytes: 2628
#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<ll, ll>;

signed main(void)
{
	int n, mx, cnt;
	cin >> n;
	mx = 0;
	cnt = 0;
	rep(i, n)
	{
		int d1, d2;
		cin >> d1 >> d2;
		if (d1 == d2)
		{
			cnt++;
			mx = max(cnt, mx);
		}
		else
			cnt = 0;
	}
	if (mx >= 3)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3620
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()

    if n >= 1800:
        print(1)
    elif n >= 1600:
        print(2)
    elif n >= 1400:
        print(3)
    elif n >= 1200:
        print(4)
    elif n >= 1000:
        print(5)
    elif n >= 800:
        print(6)
    elif n >= 600:
        print(7)
    else:
        print(8)

if __name__ == '__main__':
    main()


Measured memory_bytes: 72636
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e5+5;
const int mod=1e9+7;
char s[N];
int cnt[26];
int main(){
    int n;scanf("%d",&n);
    scanf("%s",s+1);
    int ans=1;
    for(int i=1;i<=n;i++) cnt[s[i]-'a']++;
    for(int i=0;i<26;i++) ans=1LL*ans*(cnt[i]+1)%mod;
    ans=(ans-1+mod)%mod;
    printf("%d",ans);
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

int n;
int A[1010];
int main(){
	while(cin >> n && n>0){
		double sum = 0;
		double sum2 = 0;
		for(int i=0;i<n;i++){
			cin >> A[i];
			sum += A[i];
			sum2 += A[i]*A[i];
		}
		double sd = sqrt(sum2/n-(sum/n)*(sum/n));
		printf("%.8f\n",sd);
	}
}


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

int main(){
	int A,B;

	cin >> A >> B;
	
	if( 1 <= A && A <= 9 && 1 <= B && B <= 9 ){
		cout << A * B << endl;
	}
	else
		cout << -1 << endl;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
#define f first
#define s second
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;
const double eps=1e-9;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long pw5=5,ans=0,n;
    cin>>n;
    if(n%2)
        return cout<<0,0;
    n/=2;
    while(pw5<=n)
        ans+=n/pw5,pw5*=5;
    cout<<ans;
    return 0;
}



Measured memory_bytes: 3628
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
int main()
{
    int r;
    while(cin>>r)
    {
        cout<<(double)r*1.0*acos(-1)*2<<endl;
    }
    return 0;
}


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

using namespace std;

#define PI 3.14159265358979323846264338327950L


int main(void) {
	int N, X, Y;
	map<long long, long long> ans;
	// queue<long long> que;

	cin >> N >> X >> Y;





	X--;
	Y--;

	for (long long i = 0; i < N; i++) {
		queue<long long> que;
		map<long long, bool> check;
        vector<int> dist(N,INFINITY);

		que.push(i);
		dist[i]=0;
		while (!que.empty()) {
			long long tmp;
			tmp = que.front(); que.pop();

			if (check[tmp] == true)continue;



			if (tmp + 1 < N) {
				que.push(tmp + 1);
				dist[tmp + 1] = min(dist[tmp] + 1, dist[tmp + 1]);
			}
			if (tmp - 1 >= 0) {
				que.push(tmp - 1);
				dist[tmp - 1] = min(dist[tmp] + 1, dist[tmp - 1]);
			}
			if (tmp == X) {
				que.push(Y);
				dist[Y] = min(dist[tmp] + 1, dist[Y]);
			}
			if (tmp == Y) {
				que.push(X);
				dist[X] = min(dist[tmp] + 1, dist[X]);
			}

			check[tmp] = true;


		}

        for (long long j = i + 1; j < N; j++) {
			ans[dist[j]]++;
		}
	}


	// for (long long i = 0; i < N; i++) {
	// 	for (long long j = i + 1; j < N; j++) {
	// 		ans[DIST[i][j]]++;
	// 	}
	// }

	for (long long i = 1; i <= N - 1; i++) {
		cout << ans[i] << endl;
	}


	return 0;
}



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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

#define MAX_N 200005
class UnionFind{
	public:
	int par[MAX_N], rank[MAX_N];
	void init(int n){
		for(int i=0; i<n; i++){
			par[i] = i;
			rank[i] = 0;
		}
	}

	int root(int x){
		return par[x] == x ? x : par[x] = root(par[x]);
	}

	bool same(int x, int y){
		return root(x) == root(y);
	}

	void unite(int x, int y){
		x = root(x);
		y = root(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}
};

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	UnionFind road = UnionFind();
	UnionFind rail = UnionFind();
	UnionFind total = UnionFind();
	
	int n, k, l;
	cin >> n >> k >> l;

	road.init(n+1);
	rail.init(n+1);
	total.init(n+1);
	for(int i=0; i<k; i++){
		int p, q;
		cin >> p >> q;
		p--;
		q--;

		road.unite(p, q);
	}
	for(int i=0; i<l; i++){
		int p, q;
		cin >> p >> q;
		p--;
		q--;

		rail.unite(p, q);
	}

	map<pair<int, int>, int> ans;
	for(int i=0; i<n; i++){
		auto p = make_pair(road.root(i), rail.root(i));
		if(ans.find(p) != ans.end()){
			ans[p] += 1;
		}else{
			ans[p] = 1;
		}
	}
	for(int i=0; i<n; i++){
		auto p = make_pair(road.root(i), rail.root(i));
		if(i != n-1)printf("%d ", ans[p]);
		else printf("%d\n", ans[p]);
	}

	/*
	for(int i=0; i<n; i++){
		int cnt = 0;
		for(int j=0; j<n; j++){
			if(road.same(i, j) && rail.same(i,j)){
				cnt++;
			}
		}
		if(i != n-1)printf("%d ", cnt);
		else printf("%d\n", cnt);
	}
	*/

	return 0;
}


Measured memory_bytes: 15232
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        long ans = Long.MAX_VALUE;
        if(n > k){
            n = n - (k * (n / k));
            ans = Long.min(n, Math.abs(n - k));
        } else if(n == k){
            ans = 0;
        } else {
            // (n < k)
            ans = Long.min(n, Math.abs(n - k));
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35588
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int i,j,k,m,n,N,x[16][16],y[16][16],A[16],fact[16],ans,s,t,u;
char S[100];

int main()
{
  cin >>N;
  fact[0]=1;
  for(i=1;i<=N;i++)
  {
    fact[i]=fact[i-1]*2;
    cin>>A[i];
    for(j=1;j<=A[i];j++)
    {
      cin >>x[i][j]>>y[i][j];
    }
  }

  ans=0;
  for(i=0;i<fact[N];i++)
  {

    s=0;
    for(j=1;j<=N;j++)
    {

      for(k=1;k<=A[j];k++)
      {
        if((i & fact[j-1])==fact[j-1])
        {
          
          if((y[j][k]*fact[x[j][k]-1])!=(i & fact[x[j][k]-1]))
          {
            s=1;
          }
          
        }
      }
    }
   // cout <<s <<endl;
    if(s==0)
    {
      u=0;
      for(t=0;t<N;t++)
      {
        if((i & fact[t])==fact[t])
        {
          u++;
        }
      }
      ans=max(ans,u);
    }

  }
  
  cout<<ans;
  
}

Measured memory_bytes: 256