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

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<double, double> pd;
typedef pair<int, int> pi; typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;  typedef pair<ll, pi> plp;
typedef pair<int, pi> pip; typedef tuple<int, int, int> ti;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

typedef tuple<ll, ll, ll> tl;

const int MOD = 1e9 + 7;

ll A, B, C, D, Ans = 0, N[3];
vector<tl> Ts;
ll getSum(tl ts) {
	ll a, b, c; tie(a, b, c) = ts;
	return a + b + c;
}
tl getCube(int ix, ll val) {
	ll c[3] = {0, 0, 0};
	c[ix] = val;
	for(int i=0; i<3; i++) if(ix != i)
		c[i] = N[i] * val / N[ix];
	return tl(c[0], c[1], c[2]);
}
ll getInter(ll l, ll k) {
	return min(l, k+D) - max(0ll, k-D) + 1;
}
tl getLength(tl ts) {
	ll a, b, c; tie(a, b, c) = ts;
	return tl(getInter(A-1, a), getInter(B-1, b), getInter(C-1, c));
}
ll calc(tl len, tl diff) {
	ll la, lb, lc; tie(la, lb, lc) = len;
	ll da, db, dc; tie(da, db, dc) = diff;
	ll res = da * lb % MOD * lc % MOD + 
			 db * la % MOD * lc % MOD +
			 dc * la % MOD * lb % MOD;
	return res;
}
	
int main() {
	cin >> A >> B >> C >> D;
	N[0] = A; N[1] = B; N[2] = C;
//	Ans = (2*D+1) * (2*D+1) * (2*D+1) + (A+B+C-3) * (2*D+1) * (2*D+1);
	
	for(int i=0; i<min(D+1, A); i++) Ts.push_back(getCube(0, i));
	for(int i=0; i<min(D+1, B); i++) Ts.push_back(getCube(1, i));
	for(int i=0; i<min(D+1, C); i++) Ts.push_back(getCube(2, i));
	for(int i=0; i<min(D+1, A); i++) Ts.push_back(getCube(0, A-1-i));
	for(int i=0; i<min(D+1, B); i++) Ts.push_back(getCube(1, B-1-i));
	for(int i=0; i<min(D+1, C); i++) Ts.push_back(getCube(2, C-1-i));


	sort(ALL(Ts), [&](tl ta, tl tb) {return getSum(ta) < getSum(tb);});
	Ts.erase(unique(ALL(Ts)), Ts.end());

	tl len = getLength(tl(0, 0, 0));
	ll x, y, z; tie(x, y, z) = len;
	ll ans = x * y * z;
	for(int i=1; i<SZ(Ts); i++) {
		ll pa, pb, pc; tie(pa, pb, pc) = Ts[i-1];
		ll a, b, c; tie(a, b, c) = Ts[i];
		tl diff = tl(a+D<=A-1?a-pa:0, b+D<=B-1?b-pb:0, c+D<=C-1?c-pc:0);
		ans += calc(len, diff);
		ans %= MOD;
		len = getLength(Ts[i]);
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main(){
  int X;
  cin >> X;
  if(X >= 30)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			String[] sArray = br.readLine().split(" ");
			int h = Integer.parseInt(sArray[0]);
			int w = Integer.parseInt(sArray[1]);
			if (h == 0 & w == 0) {
				break;
			}
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					System.out.print("#");
				}
				System.out.println("");
			}
			System.out.println("");
		}
	}
}

Measured memory_bytes: 31472
#include <bits/stdc++.h>
using namespace std;
 
int k,x,y,nowx=0,nowy=0;
 
struct r2{int x,y;};
vector<r2> ans;
 
void move(int x,int y){
  nowx+=x;nowy+=y;
  ans.push_back({nowx,nowy});
}
 
//main
signed main(){
  cin>>k>>x>>y;
 
  if(!(k&1)&&((x+y)&1)){
    cout<<-1<<endl;
    return 0;
  }
  if(abs(x)+abs(y)==k){
    cout<<1<<endl<<x<<" "<<y<<endl;
    return 0;
  }
 
  int X=abs(x),Y=abs(y);
  if(X>Y)swap(X,Y);
 
  int sousai=-1;
  for(int j=k*2;sousai<0;j+=k)
    if((j-(X+Y))%2==0)sousai=(j-(X+Y))/2;
 
  if(sousai){
    while(sousai>=k){
      move(0,-k);
      sousai-=k;
    }
    move(-sousai,k-sousai);
  }
 
  while(nowx+k<=X)move(k,0);
  while(nowy+k<=Y)move(0,k);
  if(nowx!=X||nowy!=Y)ans.push_back({X,Y});
 
  cout<<ans.size()<<endl;
 
  for(auto p:ans){
    int ansx=p.x,ansy=p.y;
    if(abs(x)>abs(y))swap(ansx,ansy);
    if(x<0)ansx*=-1;
    if(y<0)ansy*=-1;
    cout<<ansx<<" "<<ansy<<endl;
  }
}

Measured memory_bytes: 3952
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ull N, M; cin >> N >> M;
  auto inf = std::min(M, M / N);
  auto sup = (ull)std::sqrt(M + 1);
  ull res{};

  for(ull i = 1; i <= sup; ++i)
  {
    if(M % i == 0)
    {
      if(i <= inf) chmax(res, i);
      if(M / i <= inf) chmax(res, M / i);
    }
  }

  cout << res << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

int main(){
    double n;
    while(scanf("%lf",&n) != EOF){
        if(n <= 48.00) cout << "light fly" <<endl;
        else if(n <= 51.00) cout << "fly" << endl;
        else if(n <= 54.00) cout << "bantam" << endl;
        else if(n <= 57.00) cout << "feather" << endl;
        else if(n <= 60.00) cout << "light" << endl;
        else if(n <= 64.00) cout << "light welter" << endl;
        else if(n <= 69.00) cout << "welter" << endl;
        else if(n <= 75.00) cout << "light middle" << endl;
        else if(n <= 81.00) cout << "middle" << endl;
        else if(n <= 91.00) cout << "light heavy" << endl;
        else cout << "heavy" << endl;
    }
}

Measured memory_bytes: 1228
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n;
  while(cin >> n, n) {
    int ma = 0, mi = INF;
    REP(i,n) {
      int sum = 0;
      REP(j,5) {
        int a;
        cin >> a;
        sum += a;
      }
      ma = max(ma, sum);
      mi = min(mi, sum);
    }
    cout << ma << " " << mi << endl;
  }
  
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
int dp[100][100];

int main(){
  int h,w;cin>>h>>w;
  vector<string> s(h);
  REP(i,h) cin>>s.at(i);
  REP(i,h)REP(j,w) dp[i][j]=0;
  dp[0][0]=(s.at(0).at(0)=='#'?1:0);
  REP(i,h)REP(j,w){
      if(!i&&!j) continue;
      int fromU=1e9,fromL=1e9;
      if(i>0) fromU=dp[i-1][j]+(s.at(i).at(j)!=s.at(i-1).at(j)?1:0);
      if(j>0) fromL=dp[i][j-1]+(s.at(i).at(j)!=s.at(i).at(j-1)?1:0);
      dp[i][j]+=min(fromU,fromL);
  }
  /*REP(i,h){
    REP(j,w) cout<<dp[i][j]<<" ";
    cout<<endl;
  }*/
  
  cout<<(dp[h-1][w-1]+1)/2;
}

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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[] t = new int[3];
		t[0] = Integer.parseInt(sc.next());
		t[1] = Integer.parseInt(sc.next());
		t[2] = Integer.parseInt(sc.next());
		sc.close();

		Arrays.sort(t);

		System.out.println(t[0] + t[1]);

	}

}


Measured memory_bytes: 21716
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

k=I()
dpmod=[0 for i in range(10**6+100)]
dpmod[0]=7%k
for i in range(10**6+100-1):
    dpmod[i+1]=(10*dpmod[i])%k
dp=[0 for i in range(10**6+100)]
dp[0]=7%k
for i in range(10**6+100-1):
    if dp[i]%k==0:
        print(i+1)
        sys.exit()
    dp[i+1]=dp[i]+dpmod[i+1]
print(-1)
    
    
    




Measured memory_bytes: 164460
#include<iostream>
#include<queue>

using namespace std;
static const int N = 100;
static const int INFTY = (1<<21);

int n, M[N][N];
int d[N];

void bfs(int s)
{
  queue<int> q;
  q.push(s);
  for(int i = 0; i < n; i++)d[i] = INFTY;
  d[s] = 0;
  int u;
  while(!q.empty())
   {
     u =q.front(); q.pop();
     for(int v = 0; v < n; v++)
      {
        if(M[u][v] == 0)continue;
        if(d[v] != INFTY)continue;
        d[v] = d[u] + 1;
        q.push(v);
      }
   }  
  for(int i = 0; i < n; i++)
    {
       cout << i+1 << " " <<((d[i] == INFTY)?(-1):d[i])<<endl;
    } 
}

int main()
{
  int u, k, v;


  cin >> n;
  for(int i = 0; i < n; i++)
  {
      for(int j = 0; j < n; j++)M[i][j] = 0;
  }
  
  for(int i = 0; i < n; i++)
  {
    cin >> u >> k;
    u--;
    for(int j = 0; j < k; j++)
    {
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }

  bfs(0);

  return 0;
}

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

int main() {
  	int N, K;
  	cin >> N >> K;
  	vector<int> A(N, 0);
  	for(int i = 0 ; i < N ; i++)
      	cin >> A[i];
  	
  	// dp[i] = True if game is winnable by Taro
  	vector<bool> dp(K+1, false) ;
  	dp[0] = false;	// Taro loses if zero stones initially
	for(int i = 1 ; i <= K ; i++) {
    	for(int j = 0 ; j < N ; j++) {
          	if((i - A[j] >= 0) && (dp[i-A[j]] == false)){
              	// can make the game unwinnable for other player by  
              	// make a move of removing A[j] stones
              	// Making game unwinnable for other means 
              	// making it winnable for myself 
            	dp[i] = true;
            }
        }
    }
  
  	if(dp[K])
      	cout<<"First";
  	else
      	cout<<"Second";
  
 	return 0; 
}

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

using namespace std;

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v; stringstream ss(s); string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}
#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	int n; cin >> n;
	int A, B; cin >> A >> B;
	vector<int> f(3, 0);
	REPU(i, 0, n) {
		int p; cin >> p;
		if (p <= A) f[0]++;
		else if (p <= B) f[1]++;
		else f[2]++;
	}
	int ans = min(f[0], min(f[1], f[2]));
	cout << ans << endl;

	return 0;
}


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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  if (n%2 == 0){
    if (s.substr(0,n/2) == s.substr(n/2,n/2)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#define ll long long
#define ld  long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
ll a[2], b[2], ans=-2e18;
int main()
{
    IO
    cin>>ans;
    cout<<1-ans;
}


Measured memory_bytes: 3636
#include<iostream>
#include<math.h>
#include<cstdlib>
#include<algorithm>

using namespace std;

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

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

    sort(s,s+n);
    if(sum%10 == 0){
        for(int i=0;i<n;i++){
            if(s[i]%10!=0){
                sum -= s[i];
                break;
            }
        }
    }
    if(sum%10 == 0)cout << "0" << endl;
    else cout << sum << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String A = scan.nextLine();
		String B = scan.nextLine();
		String C = scan.nextLine();
		List<String> AList = new ArrayList<String>();
		List<String> BList = new ArrayList<String>();
		List<String> CList = new ArrayList<String>();
		String tmp = "";
		
		for(int i = 0; i < A.length(); i++) {
			AList.add(A.substring(i, i + 1));
		}
		for(int i = 0; i < B.length(); i++) {
			BList.add(B.substring(i, i + 1));
		}
		for(int i = 0; i < C.length(); i++) {
			CList.add(C.substring(i, i + 1));
		}
		
		if(AList.size() != 0) {
			tmp = AList.get(0);
			AList.remove(0);
		}
		
		while(true) {
			if(tmp.equals("a")) {
				if(AList.size() != 0) {
					tmp = AList.get(0);
					AList.remove(0);
				} else {
					System.out.println("A");
					break;
				}
			} else if(tmp.equals("b")) {
				if(BList.size() != 0) {
					tmp = BList.get(0);
					BList.remove(0);
				} else {
					System.out.println("B");
					break;
				}
			} else if(tmp.equals("c")) {
				if(CList.size() != 0) {
					tmp = CList.get(0);
					CList.remove(0);
				} else {
					System.out.println("C");
					break;
				}
			}
		}
		scan.close();
	}

}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;

////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define len(x) ((int)(x).size())
using pii = pair<int, int>;
using ll = long long;
using llu = long long unsigned;
using ld = long double;

const ld EPS = 1e-9;
inline int cmp(ld x, ld y = 0, ld tol = EPS) {
	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

const int MOD = 1;
inline int mod (ll x, int m = MOD) {
	return (int)(((x%m) + m)%m);
}

////////////////////////// Solution starts below. //////////////////////////////

const int N = 1e5+10;

int n;
int a[N][3];
int dp[N][3];

int solve (int day, int bef) {
	if (day > n)
		return 0;
	
	int &r = dp[day][bef];
	if (r != -1) return r;
	for (int i = 0; i < 3; i++)
		if (i != bef)
			r = max (r, solve (day+1, i) + a[day][i]);
		
	return r;
}

int main () {
	memset (dp, -1, sizeof dp);
	scanf ("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = 0; j < 3; j++)
			scanf ("%d", &a[i][j]);
		
	int ans = -1;
	for (int i = 0; i < 3; i++)
		ans = max (ans, solve (2, i) + a[1][i]);
	printf ("%d\n", ans);

	return 0;
}


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

int main() {
    int n; cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    vector<pair<double, double>> p(n);
    rep(i, n) {
        cin >> x.at(i);
        cin >> y.at(i);
    }

    double ans = 0.0;
    double sum = 0.0;
    int cnt = 0;
    vector<int> pp(n);
    rep(i, n) pp.at(i) = i;
    do {
        double dis = 0.0;

        rep(i, n-1) {
            double dx = (x.at(pp[i]) - x.at(pp[i+1]));
            double dy = (y.at(pp[i]) - y.at(pp[i+1]));
            dis += sqrt(dx*dx + dy*dy);
        }

        sum += dis;
        cnt++;
    } while (next_permutation(pp.begin(), pp.end()));

    printf("%.10f\n", sum/cnt);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

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

	long N, A, B;
	cin >> N >> A >> B;

	long x = N / (A+B);
	long y = N % (A+B);
	cout << A*x + min( y, A ) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int isprime(int n){
  for(int i=2;i*i<=n;i++){
    if(n%i==0)return 0;
  }
  return 1;
}
int main(){
  int k,n;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(k=n-2;k>=2;k--){
      if(isprime(k)&&isprime(k+2)){
        printf("%d %d\n",k,k+2);
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 2728
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N, K = map(int, raw_input().split())
AB = [map(int, raw_input().split()) for i in xrange(N)]

b = bin(K)
bs = [K]
for i in xrange(len(b) - 1):
    nb = list(b)
    nb[i] = "0"
    nb[i + 1:] = ["1"]*len(nb[i + 1:])
    nb = int("".join(nb), 2)
    if nb <= K:
        bs.append(nb)

ans = 0
for v in bs:
    cur = 0
    for A, B in AB:
        if v|A <= v:
            cur += B
    ans = max(ans, cur)
print ans


Measured memory_bytes: 20260
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ull unsigned long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mod 1000000007


bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;

    return true;
}


ll max(ll a,ll b)
{
    if(a>b)
    {
        return a;
    }
    return b;
}

ll min(ll a,ll b)
{
    if(a<b)
    {
        return a;
    }
    return b;
}

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

ll lcm(ll a, ll b)
{
    return (a*b)/gcd(a, b);
}


ll fact(ll n)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
        res = res * i;
    return res;
}

ll nCr(ll n, ll r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

ll fastpow(ll base,ll exp)
{
    base%=mod;
    ll ans=1;
    while(exp)
    {
        if(exp&1) {ans*=base; ans%=mod;}
        exp/=2;
        base*=base;
        base%=mod;
    }
    return ans;
}

class DSU {
public:
    int n;
    vector<int> parent,size;

    DSU(int a) {
        n = a;
        parent.assign(n,0);
        size.assign(n,0);
        for(int i=0 ; i<n ; i++) {
            parent[i] = i;
            size[i] = 1;
        }
    }

    void makeSets(int k) {
        for(int i=0 ; i<n ; i++) {
            if(find(i) != i) {
                size[i] = 0;
            }
        }
    }

    int find(int a) {
        int root = a;
        while(root != parent[root]) {
            root = parent[root];
        }
        while(root != a) {
            int temp = parent[a];
            parent[a] = root;
            a = temp;
        }
        return root;
    }

    void unionSet(int a, int b) {
        int root_a = find(a);
        int root_b = find(b);
        if(root_a == root_b) return;
        if(size[a] < size[b]) {
            parent[root_a] = root_b;
            size[root_b] += size[root_a];
        }
        else {
            parent[root_b] = root_a;
            size[root_a] += size[root_b];
        }
    }
};




int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);



ll x,y,z;
cin>>x>>y>>z;

swap(x,y);
swap(x,z);
cout<<x<<" "<<y<<" "<<z;


    return 0;
}

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

int main(){
    string input;
    cin>>input;
    vector<int>a(4);
    rep(i,4)a[i]=input[i]-'0';
    for(int x=0;x<8;x++){
        int sum=a[0];
        string s;
        s=(char)('0'+a[0]);
        for(int i=0;i<3;i++){
            if(x&(1<<i)){
                sum+=a[i+1];
                s+='+';
                s+=(char)('0'+a[i+1]);
            }
            else{
                sum-=a[i+1];
                s+='-';
                s+=(char)('0'+a[i+1]);
            }
        }
        if(sum==7){
            s+="=7";
            cout<<s<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
import java.io.*;
public class Main {
	
	public static void main(String[] args) throws IOException{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String x = br.readLine();
		String[] str = x.split(" ");
		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);
		if(a<b){
			System.out.println("a < b");
		}else if(a>b){
			System.out.println("a > b");
		}else{
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 24404
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pub push_back
#define all(in) in.begin(),in.end()

using ll = long long; // typedef long long ll; と同意
using ull = unsigned long long;
using namespace std;

int main(){
    int n; cin >> n;
    int data[n]; rep(i,n) cin >> data[i];
    sort(data, data + n);

    int ans[data[n-1]+1]; rep(i,data[n-1]+1) ans[i] = 0;
    rep(i,n){
        for(int j = data[i]; j <= data[n-1]; j += data[i]){
            ans[j]++;
        }
    }
    int count = 0;
    rep(i,n) if(ans[data[i]] == 1) count++;
    cout << count << endl;
}

Measured memory_bytes: 8260
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stdio.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
	int a,b,h,m;
	double t=0,c=0,ans=0,pi=3.14159265358979323846;

	cin>>a>>b>>h>>m;
	t=(h*60+m)*0.5;

	c=m*6;
	t= (t-c)*pi/180;
	
	
	ans=double((a*a)+(b*b)-(2*a*b*cos(t)));
	
	printf("%.20f",sqrt(ans));
	//cout<<sqrt(ans)<<endl;
	
	// your code goes here
	return 0;
}

Measured memory_bytes: 4168
n, q = map(int,input().split())
tree = [[] for i in range(n)]
v = [0]*n
for i in range(n-1):
    a1,b1 = [int(i) for i in input().split()]
    tree[a1-1].append(b1)
for i in range(q):
    p1,x1 = [int(i) for i in input().split()]
    v[p1 - 1] += x1
for i in range(n):
    for j in range(len(tree[i])):
        v[tree[i][j]-1] += v[i]
for i in range(n):
    print(str(v[i]) +" ",end="")

Measured memory_bytes: 44776
#include <stdio.h>

int main(){
	int sum=0;
	char ch;
	
	while(1){
		while((ch = getchar()) != '\n'){
			sum = sum + (ch - '0');
		}
		if(sum == 0){
			break;
		}else{
			printf("%d\n", sum);
			sum = 0;
		}
	}
}




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

// 増加し続けるループがあっても、頂点Nに到達できなければ関係ない

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m, i;
	cin >> n >> m;
	vector<int> a(m);
	vector<int> b(m);
	vector<int> c(m);
	for (i = 0; i < m; i++) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--;
		b[i]--;
	}
	long long minnum = numeric_limits<long long>::min();
	vector<long long> score(n, minnum);
	score[0] = 0;
	long long ans;
	for (i = 0; i < 2*n; i++) {
		for (int j = 0; j < m; j++) {
			if (score[a[j]]>minnum && score[b[j]] < score[a[j]] + c[j]) {
				score[b[j]] = score[a[j]] + c[j];
			}
		}
		if (i == n) ans = score[n - 1];
		if (i == 2*n - 1 && ans == score[n - 1]) {
			cout << ans << endl;
			return 0;
		}
	}
	cout << "inf" << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long N = l[0], A = l[1], B = l[2];
            var X = Console.ReadLine().Split().Select(long.Parse).ToArray();

            var diff = new long[N];
            for (var i = 1; i < N; i++)
                diff[i] = Math.Min((X[i] - X[i - 1])*A, B);

            Console.WriteLine(diff.Sum());
        }
    }
}


Measured memory_bytes: 23776
n = int(input())
*A, = map(int, input().split())
*B, = map(int, input().split())
*C, = map(int, input().split())

out = 0
last = None
for i in A:
  i -= 1
  out += B[i]
  if last == i - 1:
    out += C[last]
  last = i
print(out)

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

int main() {
	long long n,a,b;
	cin >> n >> a >> b;
	long long d;
	long long e;
	e=n/(a+b);
	d=n%(a+b);
	if(d<a)cout << a*e+d<<endl;
	if(d>=a) cout << a*e +a<<endl;
}


Measured memory_bytes: 256
t,*a=open(0)
h,w=map(int,t.split())
a=[list(map(int,x.split())) for x in a]
ret=[]
for i in range(h):
	for j in range(w-1):
		if a[i][j]%2:
			a[i][j+1]+=1
			ret+=[" ".join(map(str,[i+1,j+1,i+1,j+2]))]
for i in range(h-1):
	if a[i][-1]%2:
		a[i+1][-1]+=1
		ret+=[" ".join(map(str,[i+1,w,i+2,w]))]
print(len(ret),*ret,sep="\n")

Measured memory_bytes: 18676
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, d, e;
    int japan, math;

    cin >> a >> b >> c >> d >> e;

    if (b % d != 0) {
        japan = (b / d) + 1;
    }
    else {
        japan = b / d;
    }
    if (c % e != 0) {
        math = (c / e) + 1;
    }
    else {
        math = c / e;
    }

    cout << (a - japan < a - math ? a - japan : a - math) << endl;
}


Measured memory_bytes: 3084
#include<iostream>

int main() {
	int N;
	long long D;
	std::cin >> N >> D;
	int answer = 0;
	for (int i = 0; i < N; i++) {
		long long X, Y;
		std::cin >> X >> Y;
		if (X * X + Y * Y <= D * D) {
			answer++;
		}
	}
	std::cout << answer << std::endl;
	return 0;
}

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

long GCD(long a, long b){
  long dividend, divisor;
  if (a >= b) {
    dividend = a;
    divisor = b;
  } else {
    dividend = b;
    divisor = a;
  }
  long remainder;
  while (1) {
    if (divisor == 1) {
      return 1;
    }
    remainder = dividend % divisor;
    if (remainder == 0) {
      break;
    } else {
      dividend = divisor;
      divisor = remainder;
    }
  }
  return divisor;
}

int main(void){

  long n,Lx;
  scanf("%ld %ld", &n, &Lx);
  long x[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &x[i]);
  }
  long d = labs(Lx-x[0]);
  for (long i = 1; i < n; i++) {
    d = GCD(d,labs(x[i]-x[i-1]));
  }
  printf("%ld\n", d);

  return 0;
}

Measured memory_bytes: 896
import java.util.*;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    
           Scanner sc = new Scanner(System.in);
           int a,b,sum;
           a = sc.nextInt();
           b = sc.nextInt();
     
           int tmp = a % b;
           
          if(tmp == 0) {
             System.out.print(0); 
          } else {
             System.out.print(1);
          }
     
   }
}

Measured memory_bytes: 21972
/*
Author : Hocky Yudhiono
Min 26 Jan 2020 07:20:36  WIB

1. You can sort the query if offline!
2. Don't bring the dp remaining state when dfsing on DP on Tree.
3. Try to reverse (Think from the back) if you stuck.
4. Be careful when submitting Div. 2 D-F, dont waste it on stupid WAs.
5. Try to reduce a problem
*/

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
//If the time limit is strict, try not to use long double

#define popf pop_front
#define pf push_front
#define popb pop_back
#define mp make_pair
#define pb push_back
#define remove erase
#define fi first
#define se second

//Remember to undefine if the problem is interactive
#define endl '\n'
#define DEBUG(X) cout << ">>> DEBUG(" << __LINE__ << ") " << #X << " = " << (X) << endl

const double eps = 1e-9;
const int INFMEM = 63;
const int INF = 1061109567;
const LL LINF = 4557430888798830399LL;
const double DINF = numeric_limits<double>::infinity();
const LL MOD = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1};
const int dy[8] = {0,1,0,-1,1,-1,1,-1};
const double PI = 3.141592653589793;

inline void open(string a){
    freopen((a+".in").c_str(),"r",stdin);
    freopen((a+".out").c_str(),"w",stdout);
}

inline void fasterios(){
    //Do not use if interactive
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

LL n,d,a;
struct dt{
    LL idx, val;
    bool operator<(const dt&other)const{
        if(idx != other.idx) return idx > other.idx;
        return val < other.val;
    }
};
priority_queue <dt> antri; 

int main(){
    fasterios();
    cin >> n >> d >> a;
    vector <PLL> all;
    for(int i = 1;i <= n;i++){
        PLL tmp; cin >> tmp.fi >> tmp.se;
        all.pb(tmp);
    }
    sort(all.begin(),all.end());
    LL curdmg = 0;
    LL ans = 0;
    for(int i = 0;i < all.size();i++){
        while(!antri.empty()){
            if(antri.top().idx < all[i].fi){
                curdmg -= antri.top().val;
                antri.pop();
            }else break;
        }
        LL kanan = all[i].fi+2*d;
        LL need = all[i].se-(curdmg*a);
        if(need <= 0) continue;
        LL curadd = (1+((need-1)/a));
        ans += curadd;
        curdmg += curadd;
        // cout << kanan << " " << endl;
        antri.push({kanan,curadd});
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7020
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

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

  string s, t;
  cin >> s >> t;

  vector<vector<int>> dp(s.size() + 1, vector<int>(t.size() + 1, 0));
  vector<vector<int>> prev(s.size() + 1, vector<int>(t.size() + 1, 0));

  for (int i = 1; i <= s.size(); i++) {
    for (int j = 1; j <= t.size(); j++) {
      if (s[i-1] == t[j-1]) {
        dp[i][j] = dp[i-1][j-1] + 1;
      }
      else dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
    }
  }

  int i = s.size();
  int j = t.size();
  int len = 0;
  string ans;
  while (ans.size() < dp[s.size()][t.size()]) {
    if (s[i-1] == t[j-1]) {
      ans.push_back(s[i-1]);
      i--;
      j--;
      len++;
    } else {
      if (dp[i][j] == dp[i][j-1]) j--;
      else i--;
    }
  }

  reverse(ans.begin(), ans.end());

  cout << ans << endl;

  return 0;
}


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

int main(){
  int a, b, c;
  cin >> a;
  vector<int> v1(a,0),v2(100,0);
  for(int i=0;i<a;i++){
    cin >> v1[i];
  }

  for(int j=0;j<100;j++){
  for(int i=0;i<a;i++){
    v2[j]+=(v1[i]-j-1)*(v1[i]-j-1);
  }
  }
  sort(v2.begin(),v2.end());
  cout << v2[0] << endl;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt();
    Map<Integer,Integer> map=new HashMap<>();
    for(int i=0;i<n;i++) {
    	int buff=sc.nextInt();
    	if(map.get(buff)!=null)map.put(buff, map.get(buff)+1);
    	else map.put(buff, 1);
    }
    int m=sc.nextInt();
    for(int i=0;i<m;i++) {
    	int buff=sc.nextInt();
    	if(map.get(buff)!=null)map.put(buff, map.get(buff)-1);
    	else {
    		System.out.println("NO");
    		System.exit(0);
    	}
    	
    	if(map.get(buff)<0) {
    		System.out.println("NO");
    		System.exit(0);
    	}
    }
    System.out.println("YES");
  }
}


Measured memory_bytes: 143352
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#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 mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second

using namespace std;
int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   
   int a,b;
  cin>>a>>b;
  
  cout<<a*b<<endl;


   return 0;
}


Measured memory_bytes: 3652
from collections import Counter as counter

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
iix = lambda x:list(int(input()) for _ in range(x))
mix = lambda x:list(li() for _ in range(x))
##########
def main(n,k,q,a):
    c = counter(a)
    for i in range(1,n+1):
        print("Yes" if k-q+c[i] > 0 else "No")

n,k,q = mi()
a = iix(q)
main(n,k,q,a)

Measured memory_bytes: 11892
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] input = new int[N];
		for (int i = 0; i < N; i++) {
			input[i] = sc.nextInt();
		}
		int res = 0;
		int seq = 1;
		for (int i = 0; i < N; i++) {
			if (input[i] == seq) {
				seq++;
			} else {
				res++;
			}
		}
		if (res == N) {
			System.out.print(-1);
		} else {
			System.out.print(res);
		}
	}
}

Measured memory_bytes: 82348
n,a,b=map(int,input().split())

mod=10**9+7
def cal(n):
    if n==1:
        return 2
    else:
        if n%2==0:
            return (cal(n//2)**2)%mod
        elif n%2!=0:
            return ((cal(n//2)*cal(n-n//2))%mod)
J=cal(n)-1
def find_power(n,mod):
    # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである）
    powlist=[0]*(n+1)
    powlist[0]=1
    powlist[1]=1
    for i in range(2,n+1):
        powlist[i]=powlist[i-1]*i%(mod)
    return powlist

def find_inv_power(n):
    #0!からn!までの逆元を素数10**9+7で割ったあまりリストを作る関数
    powlist=find_power(n,10**9+7)
    check=powlist[-1]
    first=1
    uselist=[0]*(n+1)
    secondlist=[0]*30
    secondlist[0]=check
    secondlist[1]=check**2
    for i in range(28):
        secondlist[i+2]=(secondlist[i+1]**2)%(10**9+7)
    a=format(10**9+5,"b")
    for j in range(30):
        if a[29-j]=="1":
            first=(first*secondlist[j])%(10**9+7)
    uselist[n]=first
    for i in range(n,0,-1):
        uselist[i-1]=(uselist[i]*i)%(10**9+7)
    return uselist

C=find_inv_power(2*10**5+100)
if  True:
    c=1
    for i in range(a):
        c*=(n-i)
        c=c%mod
    c=c*C[a]
    c=c%mod
    d=1
    for i in range(b):
        d*=(n-i)
        d=d%mod
    d=d%mod
    d=d*C[b]
    print((J-c-d)%mod)

Measured memory_bytes: 18804
n,m=gets.split.map(&:to_i)
if m==0
    p n
    exit
end
a=gets.split.map(&:to_i)
array=[*-150..150]

array=array-a

v=100000
vv=0


array.each do |i|
   
    j=(n-i).abs
    if j<v
        v=j
        vv=i
    end
end
    
    

p vv

Measured memory_bytes: 14388
#include<iostream>
#include<fstream>
#include<algorithm>
#include<string>
#include<cstring>
#include<unordered_map>
#include<unordered_set>
#include<tuple>
#include<vector>


using namespace std;

const int MAXN = 100000 + 10;

long long A[MAXN];

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

	int N;

	cin >> N;

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

	sort(A, A + N);

	long long Ans = 0;

	if (N == 2) cout << A[1] - A[0] << endl;
	else if (N == 3) cout << max(A[2] + A[1] - 2 * A[0], A[2] * 2 - A[1] - A[0]) << endl;
	else {
		if (N % 2 == 0) {
			for (int i = N - 1; i > N / 2; i--) {
				Ans += 2 * A[i];
			}
			Ans += A[N / 2];
			for (int i = 0; i < N / 2 - 1; i++)
				Ans -= A[i] * 2;
			Ans -= A[N / 2 - 1];
		}
		else {
			for (int i = N - 1; i > N / 2; i--)
				Ans += 2 * A[i];

			Ans -= (A[N / 2] + A[N / 2 - 1]);
			for (int i = 0; i < N / 2 - 1; i++)
				Ans -= 2 * A[i];

			long long Ans1 = 0;

			for (int i = N - 1; i > N / 2 + 1; i--)
				Ans1 += 2 * A[i];

			Ans1 += (A[N / 2] + A[N / 2 + 1]);
			for (int i = 0; i < N / 2; i++)
				Ans1 -= 2 * A[i];

			Ans = max(Ans, Ans1);
		}
		cout << Ans << endl;
	}

	return 0;
}


Measured memory_bytes: 1024
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt

from sys import exit

from copy import deepcopy
import numpy as np

import bisect
import re
import heapq


ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    s = input()
    n = len(s)
    for i in range(n-2):
        if s[i] == s[i+1]:
            ans = str(i+1) + ' ' + str(i+2)
            print(ans)
            exit()
        if s[i] == s[i+2]:
            ans = str(i+1) + ' ' + str(i+3)
            print(ans)
            exit()

    if s[n-2] == s[n-1]:
        ans = str(n-1) + ' ' + str(n)
        print(ans)
        exit()
    
    print('-1 -1')








main()


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n;
ll m;
ll a[MAX_N];

ll acc[MAX_N];
map<ll, ll> cnt;
map<ll, ll> tmp_cnt;

ll ans;

int main(void) {
  // Here your code !
  scanf("%d %lld", &n, &m);

  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &(a[i]));
  }

  for (int i = 1; i <= n; ++i) {
    acc[i] = acc[i - 1] + a[i];
  }

  for (int i = 1; i <= n; ++i) {
    acc[i] %= m;
  }

  for (int i = 0; i <= n; ++i) {
    cnt[acc[i]] += 1LL;
  }

  // for (int i = 0; i <= n; ++i) {
  //   printf("%lld ", a[i]);
  // }
  // printf("\n");

  // for (int i = 0; i <= n; ++i) {
  //   printf("%lld ", acc[i]);
  // }
  // printf("\n");

  ans = 0LL;

  for (int i = 0; i < n; ++i) {
    tmp_cnt[acc[i]] += 1LL;

    ll cur_key = acc[i];

    ans += cnt[cur_key] - tmp_cnt[cur_key];

    // printf("%lld: %d\n", cur_key, cnt[cur_key]);
  }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 9728
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		String[] c = new String[h];
		for(int i = 0; i < h; i++) c[i] = sc.next();
		sc.close();

		for(int i = 0; i < h; i++){
			for(int j = 0; j < 2; j++){
				System.out.println(c[i]);
			}
		}

	}
}

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

int main()
{
  int n;
  string s;
  bool flag = true;

  cin >> n >> s;
  if (n % 2 == 1)
    flag = false;
  else
  {
    for (int i = 0; i < n / 2; i++)
    {
      if (s[i] != s[n / 2 + i])
        flag = false;
    }
  }
  cout << (flag ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define MAX 20200
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
int p[MAX],n,a[MAX],b[MAX];
int main()
{
	n=read();
	for(int i=1;i<=n;++i)a[i]=i*(n+1),b[i]=(n-i+1)*(n+1);
	for(int i=1;i<=n;++i)
	{
		int p=read();
		a[p]-=(n-i+1);
	}
	for(int i=1;i<=n;++i)printf("%d ",a[i]);puts("");
	for(int i=1;i<=n;++i)printf("%d ",b[i]);puts("");
}


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

int n, d, cnt[101];

void T_T(){ puts("Impossible"); exit(0); }
void XD(){ puts("Possible"); exit(0); }

int main(){
	scanf("%d", &n);
	for(int i = 0, x; i < n; i++){
		scanf("%d", &x);
		d = max(d, x);
		cnt[x]++;
	}
	for(int i = d; i > d / 2; i--){
		if(cnt[i] < 2) T_T();
	}
	if(d % 2 == 0 && cnt[d / 2] != 1) T_T();
	if(d % 2 == 1 && cnt[(d + 1) / 2] > 2) T_T();
	for(int i = (d - 1) / 2; i >= 1; i--) if(cnt[i]) T_T();
	XD();
}

Measured memory_bytes: 256
while True:
    h,w=map(int,input().split())
    
    if h==0 and w==0:
        break
    
    for i in range(h):
        for j in range(w):
            if i==0 or i==h-1:
                print("#",end="")
            else:
                if j==0 or j==w-1:
                    print("#",end="")
                else:
                    print(".",end="")
        print()
    print()
                    


Measured memory_bytes: 7000
#include <stdio.h>

int main() {
  int n, i, num, max, min;
  long sum;
  sum = 0;
  max = -1000000;
  min = 1000000;
  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d", &num);
    if (num < min) {
      min = num;
    }
    if (num > max) {
      max = num;
    }
    sum = sum + num;
  }
  printf("%d %d %ld\n", min, max, sum);
  return 0;
}

Measured memory_bytes: 1028
n, a, b = map(int, input().split())
n_list = [i for i in range(1, n+1)]
str_list = list(map(list, map(str, n_list)))
sum_list = [sum(map(int,str_list[j])) for j in range(n)]
T_list = [(k >= a and k<= b) for k in sum_list]
indices = [l for l, m in enumerate(T_list) if m == True]
ans = sum([n_list[n] for n in indices])
print(ans)

Measured memory_bytes: 5364
S = list(input())
q = int(input())
for i in range(q):
    cmd, a, b, *c = input().split()
    a = int(a)
    b = int(b)
    if cmd == "replace":
        S[a:b+1] = c[0]
    elif cmd == "reverse":
        S[a:b+1] = reversed(S[a:b+1])
    else:
        print(*S[a:b+1], sep='')



Measured memory_bytes: 5740
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	double A,B;

	scanf("%lf %lf",&A,&B);

	printf("%.10lf\n",B*B*B*M_PI*4/3);

	return 0;
}



Measured memory_bytes: 3236
#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<string>
#include<limits.h>
#include<cmath>
using namespace std;

int main(){
  
  int s; cin >> s;
  int ue = floor(s/100.0);
  int shita = s % 100;
  
  if (1 <= ue && ue <= 12 && 1 <= shita && shita <= 12) cout << "AMBIGUOUS";
  else if (1 <= ue && ue <= 12) cout << "MMYY";
  else if (1 <= shita && shita <= 12) cout << "YYMM";
  else cout << "NA";
 
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            B();
        }

        static void B()
        {
            var N = long.Parse(Read());
            for (var n = N; n > 0; n--)
            {
                var a = (int)Math.Sqrt(n);
                if (n == a*a)
                {
                    Console.WriteLine(n);
                    return;
                }
            }
        }

        public static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0)
                throw new Exception("0未満");

            if (start > stop || (start == 0 && stop == 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        public static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        public static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        public static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static IList<int> ReadIntInputs()
        {
            return Read().Split(' ').Select(int.Parse).ToList();
        }

        public static int ReadInt()
        {
            return int.Parse(Read());
        }

        public static IList<string> ReadInputs()
        {
            return Read().Split(' ').ToList();
        }
    }
}

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

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

vector<int> g[112345];
map< ii, int> e_to_id;
int ans[112345];
int mx = 0;
void go(int u, int p, int lst){
  set<int> s;
  int key = 1;
  s.insert(lst);
  while(s.count(key)) key++;
  for(int v : g[u]){
    if(p == v) continue;
    ans[e_to_id[ii(u,v)]] = key;
    s.insert(key);
    mx = max(mx, key);
    go(v, u, key);
    while(s.count(key)) key++;
  }
}

int32_t main(){
  DESYNC;
  int n;
  cin >> n;
  for(int i=0; i<n-1; i++){
    int u,v;
    cin >> u >> v;
    g[u].pb(v);
    g[v].pb(u);
    e_to_id[ii(u,v)] = i;
    e_to_id[ii(v,u)] = i;
    ans[i] = 0;
  }
  go(1, -1, -1);
  cout << mx << endl;
  for(int i=0; i<n-1; i++) cout << ans[i] << endl;
}




Measured memory_bytes: 28032
from collections import Counter,defaultdict,deque
from heapq import heapify,heappop,heappush
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

def check(i,j):
    for k in range(m):
        for l in range(m):
            if a[i+k][j+l] != b[k][l]:
                return False
    return True

n,m = inpl()
a = []
b = []
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())

bb = True
for i in range(n-m+1):
    for j in range(n-m+1):
        if check(i,j):
            print('Yes')
            quit()
print('No')

Measured memory_bytes: 38892