akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define ll long long
using namespace std;

ll A[222][222];
ll dp[222][222][222];


ll Solve(int x1,int y1,int x2,int y2,int H,int W) {
    if (x1==H && y1==W)
        return A[H][W];
    
    
    if (dp[x1][y1][x2]!=-1)
        return dp[x1][y1][x2];
    
    ll curr = A[x1][y1];
    if (x1 != x2)
        curr += A[x2][y2];

    ll retval = 0;
    
    for(int b1=0;b1<=1;b1++)
        for(int b2=0;b2<=1;b2++) {
            int nx1=x1;
            int ny1=y1;
            int nx2=x2;
            int ny2=y2;
            
            if (b1==0) {
                nx1++;
            } else {
                ny1++;
            }
            
            if (b2==0) {
                nx2++;
            } else {
                ny2++;
            }
            
            if (nx1 > H | ny1 > W || nx2 > H || ny2 > W)
                continue;
            retval = max(retval, curr+Solve(nx1,ny1,nx2,ny2,H,W));
        }
    return dp[x1][y1][x2]=retval;
    
    
}

int main() {
    int H,W;
    cin>>H>>W;
    for(int i=1;i<=H;i++)
        for(int j=1;j<=W;j++)
            cin>>A[i][j];
    
    for(int i=0;i<=H;i++)
        for(int j=0;j<=W;j++)
            for(int k=0;k<=H;k++)
                dp[i][j][k]=-1;
    cout << Solve(1,1,1,1,H,W) << endl;
    
}

Measured memory_bytes: 71424
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define max4(a,b,c,d) max(max(a,d),max(b,c))
#define MAX   1e9
#define MIN  -1e9
#define PI 3.14159265358979
#define eps 1e-9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(long long int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(long long int i = a; i >= (n); --i)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define trav(a, x) for(auto& a : x)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl
#define inp(a,start,len) for(long long int i = start;i < len;i++) cin>>a[i]
struct Interval{ll start,end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}

ll mod = 1000000007;
ll power1[1000001],power2[1000001],power3[1000001];

int main(){
	fio;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ll T = 1;
	// cin>>T;
	while(T--){
		ll n;
		cin>>n;
		power1[0] = 1;
		power2[0] = 1;
		power3[0] = 1;
		repA(i,1,n){
			power1[i] = (power1[i-1]*10)%mod;
			power2[i] = (power2[i-1]*9)%mod;
			power3[i] = (power3[i-1]*8)%mod;
		}
		ll ans = power1[n];
		// dbg(ans);
		ans = (ans-power2[n]+mod)%mod;
		// dbg(ans);
		ans = (ans-power2[n]+mod)%mod;
		// dbg(ans);
		ans = (ans+power3[n])%mod;
		cout<<ans;

	}
	return 0;
}


Measured memory_bytes: 26972
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, i, sum = 1;
  cin >> N >> K;
  
  for (;sum < K && i < N; i++) {
  sum *= 2;
  }
  
  for (;i < N; i++) {
  sum += K;
  }
  
  cout << sum;
}

Measured memory_bytes: 256
W,H,N = map(int,input().split())
rectangle = [[1 for i in range(W)] for j in range(H)]

def paint(x,y,a):
    if a == 1:
        for i in range(x):
            for j in range(H):
                rectangle[j][i] = 0
    if a == 2:
        for i in range(x,W):
            for j in range(H):
                rectangle[j][i] = 0
    if a == 3:
        for i in range(W):
            for j in range(y):
                rectangle[j][i] = 0
    if a == 4:
        for i in range(W):
            for j in range(y,H):
                rectangle[j][i] = 0


for i in range(N):
    x,y,a = map(int,input().split())
    paint(x,y,a)
ans = 0
for line in rectangle:
    ans += line.count(1)
print(ans)

Measured memory_bytes: 3064
H,W=map(int,input().split())
grid=[None]*H
for i in range(H):
  grid[i]=input()

R=[[0 for i in range(W)] for j in range(H)]
L=[[0 for i in range(W)] for j in range(H)]
U=[[0 for i in range(W)] for j in range(H)]
D=[[0 for i in range(W)] for j in range(H)]

for i in range(H):
  for j in range(W):
    if grid[i][j]=="#":
      L[i][j]=0
    else:
      if j-1<0:
        L[i][j]=1
      else:
        L[i][j]=L[i][j-1]+1
        
for i in range(H):
  for j in range(W-1,-1,-1):
    if grid[i][j]=="#":
      R[i][j]=0
    else:
      if j+1>=W:
        R[i][j]=1
      else:
        R[i][j]=R[i][j+1]+1
        
for j in range(W):
  for i in range(H):
    if grid[i][j]=="#":
      U[i][j]=0
    else:
      if i-1<0:
        U[i][j]=1
      else:
        U[i][j]=U[i-1][j]+1
        
for j in range(W):
  for i in range(H-1,-1,-1):
    if grid[i][j]=="#":
      D[i][j]=0
    else:
      if i+1>=H:
        D[i][j]=1
      else:
        D[i][j]=D[i+1][j]+1

maxval=0
for i in range(H):
  for j in range(W):
    maxval=max(maxval,R[i][j]+L[i][j]+U[i][j]+D[i][j])
print(maxval-3)

Measured memory_bytes: 186628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(void)
{
  long N;
  long cnt = 0;
 
  cin >> N;
  
  vector<string> s(N);
  unordered_map<string, long> table;
  rep(i,N){
    cin >> s[i];
    sort(s[i].begin(),s[i].end());
    if(table.find(s[i])==table.end()){
      table.emplace(s[i],0);
    }else{
      table[s[i]]++;
      cnt += table[s[i]];
    }
  }
  
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 17700
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int min_a = s.size();
    int max_z = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'A')
        {
            min_a = min(min_a, i);
        }
        else if (s[i] == 'Z')
        {
            max_z = i;
        }
    }
    cout << (max_z - min_a + 1) << endl;
}


Measured memory_bytes: 888
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n,m,c = i2()
b = intl()
cnt = 0
s = 0
for i in range(n):
    a = intl()
    for i in range(m):
        s += a[i]*b[i]
    if s+c > 0:
        cnt += 1
    s = 0
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <functional> //sort(A,A.end(),greater<int>());???????????????
#include <queue>
#include <stack>
#include <vector>

#define INF 10 << 10

int deck[248];

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

	for (int i = 1; i <= 2 * n; ++i) {
		deck[i] = i;
	}

	for (int i = 0; i < m; ++i) {
		int k;
		cin >> k;
		int A[248], B[248];
		if (k == 0) {
			int jj = 1;
			for (int i = 1; i <= n; ++i) {
				A[i] = deck[i];
				B[i] = deck[i + n];
			}
			jj = 1;
			for (int j = 1; j <= n; ++j) {
				deck[jj] = A[j];
				++jj;
				deck[jj] = B[j];
				++jj;
			}
		}
		else {
			for (int i = 1; i <= k; ++i) {
				A[i] = deck[i];
			}
			int jj = 1;
			for (int i = k + 1; i <= 2 * n; ++i) {
				deck[jj] = deck[i];
				++jj;
			}
			for (int i = 1; i <= k; ++i) {
				deck[jj] = A[i];
				++jj;
			}
		}
	}

	for (int i = 1; i <= 2 * n; ++i) {
		cout << deck[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 3092
fun main(args: Array<String>) {
    // Your code here!
    var (n,m) = readLine()!!.split(" ").map{it.toLong()}
    var list = readLine()!!.split(" ").map{it.toLong()}
    var ans = n - list.sum()
    
    if(ans < 0){
        ans = -1
    }
    
    println(ans)
}


Measured memory_bytes: 39384
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

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

#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T> void preview(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}

const int INF = 100000000;
const double PI = acos(-1.0), EPS = 1e-10;

int main() {
	int M; cin >> M;
	rep(m, M) {
		int start;
		int year;
		int N;
		cin >> start >> year >> N;
		vector<int> sum(N);

		rep(i,N) {
			bool hukuri;
			double par;
			int cost;
			cin >> hukuri >> par >> cost;

			if(!hukuri) {
				int now = start;
				int benefit = 0;
				rep(j,year) {
					benefit += now * par;
					now -= cost;
				}

				sum[i] = now + benefit;
			} else {
				int now = start;
				rep(j,year) {
					now *= 1.0 + par;
					now -= cost;
				}
				sum[i] = now;
			}
		}
		cout << *max_element(all(sum)) << endl;
	}

	return 0;
}

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

int main(){

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

    int wa;

    for(int i=1; i<=B; i++){
        wa = (A*i) % B;
        if(wa == C){
            break;
        }
    }

    if(wa == C){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    /*
    int num = 3;
    vector<int> hairetu(num);

    for(int i=0; i<num; i++){
        cin >> hairetu[i];
    }

    if(hairetu[0] == 1){
        cout << "YES" << endl;
    }else if(hairetu[0] != 1){
        if(((hairetu[0] % 2) == (hairetu[1] % 2)) && ((hairetu[1] % 2)) == (hairetu[2] % 2)){
            cout << "YES" << endl;
        }else if(((hairetu[0] % 2) == 1) && ((hairetu[1] % 2) == 1)){
            cout << "YES" << endl;
        }else if(((hairetu[0] % 2)) && ((hairetu[2] % 2))){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
*/


    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main()
{
  char s[10];
  scanf("%s", s);
  switch (s[0])
  {
    case 'S':
      puts("Cloudy");
      break;
    case 'C':
      puts("Rainy");
      break;
    case 'R':
      puts("Sunny");
      break;
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.math.*;

public class Main {

  // int n = sc.nextInt();
  // long m = sc.nextLong();
  // String s = sc.next();

  // // 最大公約数
  // public static long gcd (long m,long n) {
  //   if (m < n) return gcd(n,m);
  //   if (n == 0) return m;
  //   return gcd(n,m%n);
  // }
  //
  // // 最小公倍数
  // public static long lcm (long m,long n) {
  //   return m*n/gcd(m,n);
  // }
  //
  // // 素数判定
  // public static boolean isPrime (long n) {
  //   if (n == 2) return true;
  //   if (n < 2 || n%2 == 0) return false;
  //   double d = Math.sqrt(n);
  //   for (int i = 3; i <= d; i+=2) {
  //     if (n%i == 0) {
  //       return false;
  //     }
  //   }
  //   return true;
  // }
  //
  // public static final long gcd3(long[] param) {
  //   int len = param.length;
  //   long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
  //   for (int i = 1; i < len - 1; i++) {
  //       g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
  //   }
  //   return g;
  // }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    long sum = 0;

    for (int i = 0; i < m; i++) {
      sum += sc.nextInt();
    }

    if (sum <= n) {
      System.out.println(n-sum);
    } else {
      System.out.println(-1);
    }





  }

}


Measured memory_bytes: 46548
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_B main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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

    int N, D; cin >> N >> D;
    vvi X(N, vi(D));
    REP(i, N)
        REP(j, D) cin >> X[i][j];

    int ans = 0;
    REP(i,N-1){        
        FOR(j,i+1,N) {
            double dist = 0;
            REP(k, D) {
                dist += (X[i][k] - X[j][k])*(X[i][k] - X[j][k]);
            }
            int r = sqrt(dist) + 0.5;
            if (r*r == dist) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
VLL a;
ll n,k;


vector<int> divisors(int n) {
    vector<int> res;
    for(int i = 1; i*i <= n; ++i) {
        if(n % i != 0) continue;
        res.push_back(i);
        if(n/i == i) continue; // 上の行で追加済み。
        res.push_back(n/i);
    }
    return res;
}

bool solve(int x){
  VI amod(n);
  rep(i,n) amod[i] = a[i] % x;
  sort(all(amod));

  rep(i,n){
    ll minus = 0;
    ll plus = 0;
    rep(j,n){
      if(j <= i) minus += amod[j];
      else plus += x-amod[j];
    }
    ll cost = max(minus,plus);
    if(cost <= k) return true;
  }

  return false;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  a.resize(n);
  rep(i,n) cin >> a[i];
  ll sum = 0;
  rep(i,n){
    sum += a[i];
  }

  VI kouho = divisors(sum);

  sort(all(kouho));
  reverse(all(kouho));
  rep(i,kouho.size()){
    if(solve(kouho[i])){
      cout << kouho[i] << endl;
      return 0;
    }
  }
  return 0;
}


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

int N;
string S[200];
vector<int> adj[200];
bool visited[200];
int dist[200][200];

pair<int, int> longest_dist_idx(int now_idx, int now_dist, int from_idx){
    visited[now_idx] = true;
    pair<int, int> ret;
    ret.first = now_dist;
    ret.second = now_idx;
    for(int i = 0; i < adj[now_idx].size(); i++){
        if(adj[now_idx][i] != from_idx && !visited[adj[now_idx][i]]){
            visited[adj[now_idx][i]] = true;
            pair<int, int> ret_tmp = longest_dist_idx(adj[now_idx][i], now_dist + 1, now_idx);
            if(ret_tmp.first > ret.first){
                ret = ret_tmp;
            }
        }
    }
    return ret;
}

bool is_bipirtite(){
    stack<int> st;
    int color[200] = {};

    st.push(0);
    color[0] = 1;
    while(!st.empty()){
        int now = st.top();
        st.pop();
        int now_color = color[now];
        int next_color = 1 + (now_color % 2);
        for(int i = 0; i < adj[now].size(); i++){
            int next = adj[now][i];
            if(color[next] == 0){
                st.push(next);
                color[next] = next_color;
            }else if(color[next] == now_color){
                return false;
            }
        }
    }
    return true;
}

int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> S[i];
        for(int j = 0; j < N; j++){
            if(S[i][j] == '1'){
                adj[i].push_back(j);
            }
        }
    }
    if(!is_bipirtite()){
        cout << -1 << endl;
        return 0;
    }

    //pair<int, int> longest = longest_dist_idx(0, 0, -1);
    //for(int i = 0; i < N; i++){
    //    visited[i] = false;
    //}
    //pair<int, int> longest2 = longest_dist_idx(longest.second, 0, -1);
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            dist[i][j] = 1000;
            if(i == j){
                dist[i][j] = 1;
            }
            if(S[i][j] == '1'){
                dist[i][j] = 1;
            }
        }
    }

    for(int k = 0; k < N; k++){
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ret = 0;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            ret = max(ret, dist[i][j]);
        }
    }
    cout << ret + 1 << endl;


    // cout << longest2.first + 1 << endl;

}


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

int main()
{
    long long int n,k,i,sum=0;
    cin>>n>>k;
    long long int a[n+1];
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(i=0;i<n-k;i++)
        sum+=a[i];
    cout<<sum<<endl;
    return 0;
}



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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;


int N,M,P;
int d[]={0,1,-1};

int main(){
  while(1){
    cin >> N >> M >> P;
    if(N==0&&M==0&&P==0) break;
    vector<int> G[8][8]; // 0:black 1:white
    rep(i,P){
      int x, y;
      cin >> y >> x; x--; y--;
      G[y][x].push_back(i%2);
      rep(j,N) rep(k,N) rep(l,G[j][k].size()){
	if(G[j][k][l]!=i%2) continue;
	for(int dx=-1;dx<2;dx++) for(int dy=-1;dy<2;dy++) for(int dz=-1;dz<2;dz++){
	      if(dx==0&&dy==0&&dz==0) continue;
	      int ny = j, nx = k, nz = l;
	      int cnt=1;
	      while(1){
		ny += dy, nx += dx, nz += dz;
		if(nx<0||nx>=N||ny<0||ny>=N||nz<0) break;
		if(G[ny][nx].empty()||nz>=G[ny][nx].size()||G[ny][nx][nz]!=(i%2)) break;
		cnt++;
		if(cnt>=M){
		  cout << (i%2?"White ":"Black ") << i+1 << endl;
		  while(++i < P){
		    cin >> x >> y;
		  }
		  goto e;
		}
	      }
	    }
      }
    }
    cout << "Draw\n";
  e:;
  }
  return 0;
}

Measured memory_bytes: 1216
def solve():
    N = int(input())

    D1 = [0] * N
    D2 = [0] * N

    for i in range(N):
        D1[i], D2[i] = map(int, input().split())

    c = 0
    judge = 0

    for i in range(N):
        if D1[i]==D2[i]:
            c += 1
        else:
            c = 0

        if c>2:
            judge += 1

    if judge!=0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    solve()


Measured memory_bytes: 9188
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
int n;
cin>>n;
V<int> a(n),b(n),c(n);
for(int i=0;i<n;i++){
    cin>>b[i];
    a[i]=b[i];
}
for(int i=0;i<n;i++){
    cin>>c[i];
}
sort(all(a));
int cnt=1,memo=-1;
do{
bool ob=true,oc=true;
for(int i=0;i<n;i++){
    if(a[i]!=b[i])ob=false;
    if(a[i]!=c[i])oc=false;
}
if(ob&&memo!=-1){
    cout<<cnt-memo<<endl;
    return 0;
}
if(ob){
    memo=cnt;
}
if(oc&&memo!=-1){
    cout<<cnt-memo<<endl;
    return 0;
}
if(oc)memo=cnt;
cnt++;
}while(next_permutation(all(a)));
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int k = scanner.nextInt();
        int kk = k/2;
		if(k%2==0){
			System.out.print(kk * kk);
			System.exit(0);
		}
		System.out.print(kk + kk * kk);
	}
}

Measured memory_bytes: 21716
n, m = map(int, input().split())
H = list(map(int, input().split()))
bridge = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    bridge[a - 1].append(b - 1)
    bridge[b - 1].append(a - 1)
s = 0
#print(bridge)
for i in range(len(bridge)):
    if not(bridge[i]):
        s += 1
    elif H[i] > max([H[j] for j in bridge[i]]):
        s += 1
print(s)



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X,Y,Z; cin >> X >> Y >> Z;
    int N=X+Y+Z;
    vector<ll> A(N),B(N),C(N);
    for (int i=0;i<N;++i) cin >> A[i] >> B[i] >> C[i];
    vector<pair<ll,int>> order;
    for (int i=0;i<N;++i) order.emplace_back(B[i]-A[i],i);
    sort(order.begin(),order.end());
    ll cnt0=0,cnt1=0;
    priority_queue<ll,vector<ll>,greater<ll>> pq;
    for (int i=0;i<X;++i){
        int j=order[i].second;
        cnt0+=C[j],cnt1+=A[j]-C[j];
        pq.emplace(A[j]-C[j]);
    }
    vector<ll> sum(N,0);
    sum[X-1]+=cnt0+cnt1;
    for (int i=X;i<N-Y;++i){
        int j=order[i].second;
        cnt0+=C[j];
        if (pq.top()<A[j]-C[j]){
            cnt1+=A[j]-C[j]-pq.top();
            pq.pop(); pq.emplace(A[j]-C[j]);
        }
        sum[i]+=cnt0+cnt1;
    }
    cnt0=cnt1=0; pq=decltype(pq)();
    for (int i=N-1;i>=N-Y;--i){
        int j=order[i].second;
        cnt0+=C[j],cnt1+=B[j]-C[j];
        pq.emplace(B[j]-C[j]);
    }
    sum[N-Y-1]+=cnt0+cnt1;
    for (int i=N-Y-1;i>=X;--i){
        int j=order[i].second;
        cnt0+=C[j];
        if (pq.top()<B[j]-C[j]){
            cnt1+=B[j]-C[j]-pq.top();
            pq.pop(); pq.emplace(B[j]-C[j]);
        }
        sum[i-1]+=cnt0+cnt1;
    }
    ll ans=0;
    for (int i=0;i<N;++i) ans=max(ans,sum[i]);
    cout << ans << '\n';
}

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

int main(void){
	int a[5],i,j,x;
	scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
	for(i=1;i<5;i++){
		for(j=i;j>0;j--){
			if(a[j]>a[j-1]){
				x=a[j];
				a[j]=a[j-1];
				a[j-1]=x;
			}
		}
	}
	printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
	return 0;
}

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

using namespace std;

#define ll long long

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

const int mod = 998244353;

int main(){

	cin.tie(0);
	cin.sync_with_stdio(0);

	#ifdef Cyborg101
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	
	int n, k;
	cin >> n >> k;

	int a[n], b[n];

	for(int i = 0; i < n; ++i){
		cin >> a[i] >> b[i];
	}

	ll res = 0;
	for(int i = 0; i < n; ++i){
		if((a[i] | k) == k)
			res += b[i];
	}

	int cur = k;
	while(cur){
		int lsb = cur & -cur;
		cur ^= lsb; //remove lsb
		cur |= lsb - 1; // add whatever we can < lsb
		ll here = 0;
		for(int i = 0; i < n; ++i){
			if((a[i] | cur) == cur)
				here += b[i];
		}
		res = max(here, res);
		cur ^= lsb - 1;
	}

	cout << res << endl;

	return 0;
	
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
int inf=1000000000;
ll INF=10000000000000000;
int main(){
    string s;
    cin >> s;
    int ans=s.size(),t=0;
    rep(i,s.size()){
        //cout << i << " " << t << endl;
        if (t==0) {t=1;continue;}
        if (s.at(i-1)==s.at(i)){
            t=0;
            i++;
            ans--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd>> Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod

const ll MaxN=1001001;

ll f[MaxN], rf[MaxN], p[MaxN], rp[MaxN];
ll inv(ll x) {
    ll res = 1;
    ll k = mod - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % mod;
        y = (y * y) % mod;
        k /= 2;
    }
    return res;
}
void init() {
    f[0] = 1;
    REP(i, 1, MaxN) f[i] = (f[i - 1] * i) % mod;
    REP(i, 0, MaxN) rf[i] = inv(f[i]);
    p[0]=1;
    REP(i,1,MaxN) p[i]=(p[i-1]*i)%mod;
    REP(i, 0, MaxN) rp[i]=inv(p[i]);

}
//---------------------------------------------------------------------------------------------------
ll C(ll n, ll k) {
    ll a = f[n]; // = n!
    ll b = rf[n-k]; // = (n-k)!
    ll c = rf[k]; // = k!

    ll bc = (b * c) % mod;

    return (a * bc) % mod;
}

ll Pa(ll n, ll k){
    return p[n]*rp[n-k]%mod;
}

ll ruijou(ll n, ll k){
    if(!k) return 1;
    if(!n) return 1;
    ll a=ruijou(n,k/2);
    a=(a*a)%mod;
    return k%2 ? (a*n)%mod : a;
}


int main(){
    init();
    
    //REP(i,1,30) cout<<p[i]<<endl;
    ll N,M; cin>>N>>M;
    ll ret=0;
    REP(i,0,N+1){
        ll k=C(N,i);
        k=(k*Pa(M,i))%mod;
        k=(k*Pa(M-i,N-i))%mod;
        k=(k*Pa(M-i,N-i))%mod;
        //cout<<i<<':'<<k<<endl;
        if(i%2) k=mod-k;
        ret=(ret+k)%mod;
    }
    cout<<ret<<endl;
    

}

Measured memory_bytes: 34880
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
count = 0

for i in range(N):
    A = list(map(int, input().split()))
    calc = sum( [(A[i] * B[i]) for i in range(M)] ) + C
    if calc > 0:
        count += 1
        
print(count)

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

using namespace std;

const int maxn = 100100;

int t[maxn],x[maxn],y[maxn],n;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for (int i=1;i<=n;i++) cin>>t[i]>>x[i]>>y[i];
    x[0] = 0; y[0] = 0;
    for (int i=1;i<=n;i++) {
        int l = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1]);
        int ti = t[i] - t[i-1];
        if ((l%2 != ti%2) || (l > ti)) {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e3+5;
int n,a[3][N],f[3][N];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=2;i++)
    	for(int j=1;j<=n;j++)
    		cin>>a[i][j];
    	
    for(int i=1;i<=2;i++)
    {
    	for(int j=1;j<=n;j++)
    	{
    		f[i][j]=max(f[i-1][j],f[i][j-1])+a[i][j];	
		}
	}
	cout<<f[2][n]<<endl;
	    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  ll A,B;
  cin >> A >> B;

  if(A<B){
    if(abs(A)==abs(B)){
      cout << 1 << endl;
    }else if(abs(A)<abs(B)){
      if(A>=0){
        cout << B-A << endl;
      }else{
        cout << B+A+1 << endl;
      }
    }else{
      if(B>0){
        cout << -A-B+1 << endl;
      }else{
        cout << B-A << endl;
      }
    }
  }else{
    if(abs(A)==abs(B)){
      cout << 1 << endl;
    }else if(abs(A)<abs(B)){
      if(A>=0){
        cout << -B-A+1 << endl;
      }else{
        cout << A-B+2 << endl;
      }
    }else{
      if(B<=0){
        cout << B+A+1 << endl;
      }else{
        cout << A-B+2 << endl;
      }
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int H, W, N;
	cin >> H >> W >> N;

	vector<Int> a(N);
	for (Int i = 0; i < N; i++) {
		cin >> a[i];
	}

	vector<vector<Int>> color(H, vector<Int>(W, -1));

	Int flag = 1;//→方向
	Int i = 0;
	Int j = 0;
	Int k = 0;//色
	while (a[N - 1]) {
		if (a[k]) {
			if (flag) {
				color[i][j] = k;
				a[k]--;
				j++;
				if (j == W) {
					j--;
					flag = 0;
					i++;
					continue;
				}
			}
			else {
				color[i][j] = k;
				a[k]--;
				j--;
				if (j == -1) {
					j++;
					flag = 1;
					i++;
					continue;
				}
			}
		}
		else {
			k++;
		}
	}

	for (Int i = 0; i < H; i++) {
		for (Int j = 0; j < W; j++) {
			printf("%ld ", color[i][j] + 1);
		}
		printf("\n");
	}

}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int h, w; cin >> h >> w;
	vector<string> x(h), y(h), z(h);
	rep(i, h) cin >> z[i];
	rep(i, h){
		x[i] = y[i] = string(w, '.');
		x[i][0] = y[i][w - 1] = '#';
		for(int j = 1; j < w - 1; j++){
			if(i % 2) x[i][j] = '#';
			else y[i][j] = '#';
		}
	}
	rep(i, h) rep(j, w) if(z[i][j] == '#') x[i][j] = y[i][j] = '#';
	rep(i, h) cout << x[i] << endl;
	cout << endl;
	rep(i, h) cout << y[i] << endl;
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    ll n;
    cin>>n;
    ll ans=1;
    while(1){
        if(ans*ans>n) break;
        ++ans;
    }
    --ans;
    cout<<ans*ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
#include <map>
#include <set>
using namespace std;
using ll = long long;

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



int main(){
    ll a,b,c;
    cin >> a >> b;
    
    ll g = gcd(a,b);
    ll v=2;
    ll count = 1;
    set<ll> ans;
    
    while(g >= v*v){
        if(g%v==0){
            ans.insert(v);
            
            while(g%v==0){
                g /= v;
            }
            v += 1;
        }
        else v += 1;

    }
    
    
    ans.insert(g);
    ans.insert(1);


    cout << ans.size();
    


}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#pragma endregion

std::vector<std::vector<long long>> warshallFloyd(const WGraph &G) {
    int n = (int)G.size();
    std::vector<std::vector<long long>> dis(n, std::vector<long long>(n, LINF));
    for (int i=0; i<n; i++) {
        dis.at(i).at(i) = 0;
    }
    for (int i=0; i<n; i++) {
        for (auto e : G.at(i)) {
            dis.at(i).at(e.first) = e.second;
        }
    }

    for (int k=0; k<n; k++) {
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                dis.at(i).at(j) = std::min(dis.at(i).at(j), dis.at(i).at(k) + dis.at(k).at(j));
            }
        }
    }

    return dis;
}

void solve() {
    int n, m, r;
    cin >> n >> m >> r;
    vector<int> rr(r);
    for (int i=0; i<r; i++) {
        cin >> rr.at(i);
    }
    sort(rr.begin(), rr.end());
    WGraph G(n);
    for (int i=0; i<m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        G.at(a-1).push_back(make_pair(b-1, c));
        G.at(b-1).push_back(make_pair(a-1, c));
    }
    auto dis = warshallFloyd(G);
    ll res = LINF;
    do {
        ll tmp = 0;
        bool ok = true;
        for (int i=1; i<r; i++) {
            if (dis.at(rr.at(i)-1).at(rr.at(i-1)-1) == LINF) {
                ok = false;
                break;
            } else {
                tmp += dis.at(rr.at(i)-1).at(rr.at(i-1)-1);
            }
        }
        if (ok) chmin(res, tmp);
    } while (next_permutation(rr.begin(), rr.end()));
    cout << res << "\n";
}

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

    solve();

    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
using db = double;
#define INF 2000000000
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
数値型から文字列に変換　to_string(number);これは簡単
文字列から数値型に変換　stoi(number)
文字列からllに変換　stoll(number)
__gcd(a,b)は最大公約数を取ってくれる、aとb
の大きい方をNとしたとき、計算量は log(N);
*/
const int mod = 1e9 + 7;

//ここから書き始める
int main(){
	ll n,m ;// nは整数

	int h , w;
	cin >> h >> w;
	vector<string> V(2*h);
	rep(i,h) {
		cin >> V[2*i];
		V[2*i+1]=V[2*i];
	}
	for(auto x : V){
		cout << x << endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>
         
        int main(void)
        {
            char num[5];
            if (scanf("%s", num) != -1)
                for (int i = 0; i < 3; i++)
                {
                    if (num[i] == num[i + 1])
                    {
                        puts("Bad");
                        break;
                    }
                    else if (num[i] != num[i + 1] && i == 2)
                    {
                        puts("Good");
                    }
                }
            return 0;
        }

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
    oreno_initializer() {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }
} oreno_initializer;



int n, a[100100], l[100100], r[100100], res;

signed main() {
    cin >> n;
    reps(i,1,n+1) cin >> a[i];
    reps(i,1,n+1) l[i] = gcd(l[i-1], a[i]);
    repr(i,n) r[i] = gcd(r[i+1], a[i]);
    reps(i,1,n+1) chmax(res, gcd(l[i-1], r[i+1]));
    cout << res << endl;
}

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

typedef long long ll;

int main() {
    int K;
    string S;
    cin >> K >> S;
    if (S.size() <= K) cout << S << "\n";
    else cout << S.substr(0, K) << "...\n";
}

Measured memory_bytes: 3628
package main

import "fmt"

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var s string
	var i int
	fmt.Scanf("%d", &i)
	fmt.Scanf("%s", &s)
	n := 0
	for i := 1; i < len(s); i++ {
		n = max(n, solve(s[0:i], s[i:]))
	}
	fmt.Println(n)
}

func solve(a, b string) int {
	ma := make(map[uint8]bool)
	mb := make(map[uint8]bool)
	for i := 0; i < len(a); i++ {
		ma[a[i]] = true
	}
	for i := 0; i < len(b); i++ {
		mb[b[i]] = true
	}
	res := 0
	for key := range ma {
		if mb[key] {
			res++
		}
	}
	return res
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

void Swap(int *a, int *b, int *c)
{
    int temp;
    temp = *b;
    *b = *a;
    *a = *c;
    *c = temp;
}


int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    Swap(&a, &b, &c);
    cout << a << " " << b << " " << c << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
const int mod = 1e9+7;

int main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    cout << x*min(n,k) + y*max(0,n-k) << endl;
}

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

using namespace std;

typedef long long ll;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n, m;
    cin >> n >> m;
    ll t = min(n, m >> 1);
    m -= 2 * t;
    t += m >> 2;
    cout << t;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        List<Long> list = new ArrayList<Long>();
        Scanner scan = new Scanner(System.in);
        long n = scan.nextLong();
 
        for(int i = 0 ; i < 5; i++) {
            list.add(scan.nextLong());
        }
        long min = Collections.min(list);
        
        long ans = (n / min) + 4;
        if(n % min != 0){
            ans += 1;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int n;
string si, so;
int main() {
	cin >> n;
	if (n<600) cout << '8';
	else if (n<800) cout << '7';
	else if (n<1000) cout << '6';
	else if (n<1200) cout << '5';
	else if (n<1400) cout << '4';
	else if (n<1600) cout << '3';
	else if (n<1800) cout << '2';
	else cout << '1';
}

Measured memory_bytes: 3624
#include<stdio.h>
int main(void)
{
	int g,o,i,p[9],j[9];
	char c[31][9];
	for(i=0;i<9;i++){
		scanf("%s%d%d",&c[i],&g,&o);
		p[i]=g+o;
		j[i]=g*200+o*300;
		printf("%s %d %d\n",c[i],p[i],j[i]);
	}
	return 0;
}

Measured memory_bytes: 596