akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    int N, M, Q;
    scanf("%d %d %d\n", &N, &M, &Q);
    vector<vector<char>> grid(N+1, vector<char>(M+1, '0'));
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            scanf("%c", &grid[i][j]);
        }
        scanf("\n");
    }
    vector<vector<int>> psum(N+1, vector<int>(M+1, 0));
    vector<vector<int>> horsum(N+1, vector<int>(M+1, 0));
    vector<vector<int>> versum(N+1, vector<int>(M+1, 0));
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            if (grid[i][j] == '1') {
                psum[i][j]++;
                if (grid[i][j-1] == '1') horsum[i][j]++;
                if (grid[i-1][j] == '1') versum[i][j]++;
            }
            psum[i][j] += psum[i][j-1] + psum[i-1][j] - psum[i-1][j-1];
            horsum[i][j] += horsum[i][j-1] + horsum[i-1][j] - horsum[i-1][j-1];
            versum[i][j] += versum[i][j-1] + versum[i-1][j] - versum[i-1][j-1];
        }
    }
    
    for (int z = 0; z < Q; z++) {
        int x1, x2, y1, y2;
        scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
        int ps = psum[x2][y2] - psum[x1-1][y2] - psum[x2][y1-1] + psum[x1-1][y1-1];
        int hors = horsum[x2][y2] - horsum[x1-1][y2] - horsum[x2][y1] + horsum[x1-1][y1];
        int vers = versum[x2][y2] - versum[x1][y2] - versum[x2][y1-1] + versum[x1][y1-1];
        printf("%d\n", ps - hors - vers);
    }
    
    return 0;
}

Measured memory_bytes: 52992
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int32_t main()
{
  uint32_t num;
  cin >> num;

  vector<long long> vec;
  long long total = 0;

  for (uint32_t i = 0; i < num; i++) {
    long long val;
    cin >> val;
    total += val;
    vec.push_back(val);
  }

  long long subtotal = vec[0];
  long long min_val = abs(total - 2 * subtotal);
  for (uint32_t i = 1; i < vec.size() - 1; i++) {
    subtotal += vec[i];
    min_val = min(abs(total - 2 * subtotal), min_val);
  }

  cout << min_val << endl;
  return 0;
}


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

int main(){
    int A, B, M;
    cin >> A >> B >> M;
    vector<int> a(A), b(B);
    int minA = 1001001001, minB = 1001001001;
    rep(i, A) {
        cin >> a[i];
        minA = min(minA, a[i]);
    }
    rep(i, B) {
        cin >> b[i];
        minB = min(minB, b[i]);
    }
    int ans = minA + minB;
    rep(i, M) {
        int x, y, c;
        cin >> x >> y >> c;
        int tmp = a[x-1] + b[y-1] - c;
        ans = min(tmp, ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int nmax=10005;
int main(){
  int n;cin >> n;
  vector<vector<int>> g(n);
  for(int i=0;i<n-1;i++){
    int a,b;cin >> a >> b;
    a--,b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> c(n),ans(n);
  for(int i=0;i<n;i++){
    cin >> c[i];
  }
  sort(c.begin(),c.end(),greater<int>());
  vector<bool> vis(n);
  queue<int> q;
  q.push(0);
  vis[0]=true;
  int cnt=0;
  ans[0]=c[cnt];
  cnt++;
  while(!q.empty()){
    int p=q.front();
    q.pop();
    for(auto x:g[p]){
      if(!vis[x]){
        ans[x]=c[cnt];
        cnt++;
        vis[x]=true;
        q.push(x);
      }
    }
  }
  int sum=0;
  for(int i=1;i<n;i++){
    sum+=c[i];
  }
  cout << sum << endl;
  for(int i=0;i<n;i++){
    cout << ans[i] << " ";
  }
  cout << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return 1; }
  return 0; }
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return 1; }
  return 0; }
ll MOD = 1000000007;

int main(){
  int n,x,t; cin >> n >> x >> t;
  int y = n/x;
  int z = y*t;
  if(n%x != 0) cout << z + t << endl;
  else cout << z<< endl;
  return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
int A[100000];
int partition(int p,int r);
int main(){
  int n,z,i;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  z=partition(0,n-1);
  for(i=0;i<n-1;i++){
    if(i==z)printf("[%d] ",A[i]);
    else printf("%d ",A[i]);
  }
  printf("%d\n",A[n-1]);
  return 0;
}

int partition(int p,int r){
  int i,j,x,y,z;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      y=A[i];
      A[i]=A[j];
      A[j]=y;
    }
  }
    z=A[i+1];
    A[i+1]=A[r];
    A[r]=z;
    return i+1;
}



Measured memory_bytes: 2980
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int A,B,K;
  cin>>A>>B>>K;
  vector<int> v;
  FOR(i,1,min(A,B)+1)if(B%i==0 and A%i==0)v.push_back(i);
  auto itr=v.rbegin();
  itr+=K-1;
  cout<<*itr<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, n, m) for(int i = n; i < (int)m; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = std::int_fast64_t;
using P = pair<ll, ll>;
constexpr ll inf = 1000000000;
constexpr ll mod = 1000000007;
constexpr long double eps = 1e-15;
template<typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> p) {
    os << to_string(p.first) << " " << to_string(p.second);
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, v.size()) {
        if(i) os << " ";
        os << to_string(v[i]);
    }
    return os;
}

struct modint {
    ll n;
public:
    modint(const ll n = 0) : n((n % mod + mod) % mod) {}
    static modint pow(modint a, int m) {
        modint r = 1;
        while(m > 0) {
            if(m & 1) { r *= a; }
            a = (a * a); m /= 2;
        }
        return r;
    }
    modint &operator++() { *this += 1; return *this; }
    modint &operator--() { *this -= 1; return *this; }
    modint operator++(int) { modint ret = *this; *this += 1; return ret; }
    modint operator--(int) { modint ret = *this; *this -= 1; return ret; }
    modint operator~() const { return (this -> pow(n, mod - 2)); } // inverse
    friend bool operator==(const modint& lhs, const modint& rhs) {
        return lhs.n == rhs.n;
    }
    friend bool operator<(const modint& lhs, const modint& rhs) {
        return lhs.n < rhs.n;
    }
    friend bool operator>(const modint& lhs, const modint& rhs) {
        return lhs.n > rhs.n;
    }
    friend modint &operator+=(modint& lhs, const modint& rhs) {
        lhs.n += rhs.n;
        if (lhs.n >= mod) lhs.n -= mod;
        return lhs;
    }
    friend modint &operator-=(modint& lhs, const modint& rhs) {
        lhs.n -= rhs.n;
        if (lhs.n < 0) lhs.n += mod;
        return lhs;
    }
    friend modint &operator*=(modint& lhs, const modint& rhs) {
        lhs.n = (lhs.n * rhs.n) % mod;
        return lhs;
    }
    friend modint &operator/=(modint& lhs, const modint& rhs) {
        lhs.n = (lhs.n * (~rhs).n) % mod;
        return lhs;
    }
    friend modint operator+(const modint& lhs, const modint& rhs) {
        return modint(lhs.n + rhs.n);
    }
    friend modint operator-(const modint& lhs, const modint& rhs) {
        return modint(lhs.n - rhs.n);
    }
    friend modint operator*(const modint& lhs, const modint& rhs) {
        return modint(lhs.n * rhs.n);
    }
    friend modint operator/(const modint& lhs, const modint& rhs) {
        return modint(lhs.n * (~rhs).n);
    }
};
istream& operator>>(istream& is, modint m) { is >> m.n; return is; }
ostream& operator<<(ostream& os, modint m) { os << m.n; return os; }

using mi = modint;

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


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, X;
    cin >> N >> X;
    vector<int> x(N);
    REP(i, N) cin >> x[i];
    x.pb(X);
    N++;
    ll ans = abs(x[0] - x[1]);
    FOR(i, 1, N) {
        ans = gcd(ans, abs(x[i] - x[i - 1]));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int greater_cmp(const void *x, const void *y);

int main()
{
	char s[105];
	char t[105];

	scanf("%s", s);
	scanf("%s", t);

	qsort(s, strlen(s), sizeof(char), (int (*)(const void *, const void *))strcmp);
	qsort(t, strlen(t), sizeof(char), greater_cmp);

	if (strcmp(s, t) < 0) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}

int greater_cmp(const void *x, const void *y)
{
	return -1 * strcmp(x, y);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);

       		String initailString = scanner.nextLine();
		String[] strStdIn = initailString.split(" ", 0);
		int verticalNum = Integer.parseInt(strStdIn[0]);

		String[] strPixel = new String[verticalNum];

		for (int i=0; i < verticalNum; i++) {
			strPixel[i] = scanner.nextLine();
		}

		for (int m=0; m < verticalNum; m++) {
			System.out.println(strPixel[m]);
			System.out.println(strPixel[m]);
		}
	}
}

Measured memory_bytes: 11572
K = int(input())
[A,B]= [int(s) for s in input().rstrip().split(' ')]
[a_1,a_2] = [A//K,A%K]
[b_1,b_2] = [B//K,B%K]
if a_1 != b_1:
    print("OK")
else:
    if a_2==0 or b_2==0:
        print("OK")
    else:
        print("NG")

Measured memory_bytes: 9188
def main():
    A, B, C, X, Y = map(int, input().split())
    
    if A + B <= 2*C:
        print(A*X+B*Y)
    
    elif A + B > 2*C:
        cost = 0
        mi = min(X, Y)
        cost += 2*C*mi
        X -= mi
        Y -= mi
        
        if X > 0 and Y == 0:
            if A <= 2*C:
                cost += A*X
            else:
                cost += 2*C*X
        else:
            if B <= 2*C:
                cost += B*Y
            else:
                cost += 2*C*Y
        print(cost)
if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
int main(){
    string s;
    cin >> s;
    int i,l = s.length(),ans,tmp;
    vector<int> a(l);
    for(i=0;i<l;i++) a.at(i) = s.at(i) - '0';
    ans = 1000;
    for(i=0;i<l-2;i++){
        tmp = 100*a.at(i)+10*a.at(i+1)+a.at(i+2);
        ans = min(ans,abs(tmp-753));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def selectionSort(A, N):
    count = 0
    for i in range(N-1):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp
            count += 1
    return count

N = int(input())
A = list(map(int, input().split()))
c = selectionSort(A, N)
print(" ".join(map(str, A)))
print(c)



Measured memory_bytes: 5596
import Foundation

func readInt() -> [Int]{
    return readLine()!.split(separator: " ").map{Int($0)!}
}

func main() {
    let N = Int64(readLine()!)!
    var ans: Int64 = 0
    for i in 1...N {
        if i % 15 != 0 && i % 5 != 0 && i % 3 != 0 {
            ans += i
        }
    }
    
    print(ans)
}

main()


Measured memory_bytes: 13200
#include <iostream>

using namespace std;

int main() {
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    
    for (int i = 0; i < n; i++) {
        int x1;
        cin >> x1;
        if (x1 > x) {
            x = x1;
        }
    }
    for (int i = 0; i < m; i++) {
        int y1;
        cin >> y1;
        if (y1 < y) {
            y = y1;
        }
    }
    
    if (x < y) {
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 88, X = 12721;
int a[N][N], b[N][N];
int dp[N][N][2 * X];
int n, m;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    rep(i, 1, n) {
        rep(j, 1, m) {
            cin >> a[i][j];
        }
    }
    rep(i, 1, n) {
        rep(j, 1, m) {
            cin >> b[i][j];
        }
    }
    dp[0][1][X] = true;
    rep(i, 1, n) {
        rep(j, 1, m) {
            int diff = a[i][j] - b[i][j];
            rep(px, 0, 2 * X - 1) {
                int x = px + diff;
                if(x >= 0 && x < 2 * X && dp[i - 1][j][px] || dp[i][j - 1][px]) {
                    dp[i][j][x] = true;
                }
                x = px - diff;
                if(x >= 0 && x < 2 * X && dp[i - 1][j][px] || dp[i][j - 1][px]) {
                    dp[i][j][x] = true;
                }
            }
        }
    }
    int ans = 1e9;
    rep(x, 0, 2 * X - 1) {
        if(dp[n][m][x]) {
            ans = min(ans, abs(x - X));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 700800
# -*- coding: utf-8 -*-

from sys import stdin

def load():
    n = stdin.readline()
    return n

def calc(n):
    return n.count("2")

n = load()
a,b,c = [ int(x) for x in n.split(' ')]

if (a==b and b==c):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cstdio>
#include <utility>
#include <algorithm>
using std::cin;
using std::cout;
using std::endl;

int main(void)
{
    double n, m, d;
    cin >> n >> m >> d;
    double answer;
    if (d == 0)
    {
        answer = 1.0 / n * (m - 1);
    }
    else
    {
        answer = 2.0 * (n - d) * (m - 1) / n / n;
    }

    //cout << answer << endl;
    printf("%f\n",answer);

    return 0;
}


Measured memory_bytes: 256
//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=300005;
vi v[N];
void solve(){
    ll n,m,a,b;
    cin>>n>>m;
    rep(i,0,m-1){
        cin>>a>>b;
        a--;b--;
        v[a].pb(b+n);
        v[a+n].pb(b+2*n);
        v[a+2*n].pb(b);
    }
    ll s,t;
    cin>>s>>t;
    s--;t--;
    vi dis(N,-1);
    dis[s]=0;
    queue <ll> q;
    q.push(s);
    while(!q.empty()){
        ll curr=q.front();
        q.pop();
        for(auto i:v[curr]){
            if(dis[i]==-1){
                dis[i]=dis[curr]+1;
                q.push(i);
            }
        }
    }
    if(dis[t]==-1) cout<<"-1";
    else cout<<dis[t]/3;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 19072
n = int(input())

x = []
for i in range(n):
  x.append(int(input()))

first = sorted(set(x))[-1]

if len(set(x))==1:
  second = -100
else:
  second = sorted(set(x))[-2]

max_count = x.count(max(x))

for i in x:
  if (i == first) and (max_count == 1):
    if second == -100:
      print(first)
    else:
      print(second)
  elif (i == first) and (max_count != 1):
    print(first)
  else:
    print(first)
 

Measured memory_bytes: 19200
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
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 (b<a) { a=b; return 1; } return 0; }

int main() {
  int N, R;
  cin >> N >> R;
  int ans = R;
  if (N <= 10) ans += 100 * (10 - N);
  cout << ans << endl;
  return 0;
}


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

int main()
{
 bool flag1 = true ;
 bool flag2 = true ;
 int N;
 cin >> N ;
 int a[N];
 for (int i=0 ; i<N ; i++)
    cin >> a[i];
 int counter = 0 ;
 for (int i=1 ; i<=N ; i++)
    {
      if (i%2 == 0)
        flag1=false ;
      else if (a[i-1]%2 == 0)
        flag2 = false ;
      if (flag1 && flag2)
        counter++ ;
        flag1 = true ;
        flag2 = true ;

    }
      cout << counter << endl ;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i, n) for(int i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(int i = 0; i < n; i += k)



int main() {
	string s;
	cin >> s;

	if (s[0] != 'A') {
		cout << "WA" << endl;
		return 0;
	}

	ll i;
	for (i = 2; i < s.size() - 1; i++) {
		if (s[i] == 'C')break;
	}
	if (i == s.size() - 1) {
		cout << "WA" << endl;
		return 0;
	}

	for (ll j = 1; j < s.size(); j++) {
		if (i == j)continue;
		if (!('a' <= s[j] && s[j] <= 'z')) {
			cout << "WA" << endl;
			return 0;
		}
	}

	cout << "AC" << endl;
} 

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			long x = in.nextLong();
			long[] a = in.nextLongArray(n);

			long ans = 0;
			Arrays.sort(a);
			for (int i = 0; i < n-1; i++) {
				if (x - a[i] >= 0) {
					x -= a[i];
					ans++;
				} else {
					break;
				}
			}

			if (x > 0 && x == a[n-1]) {
				ans++;
			}

			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

		public int[] nextIntArray1Index(int n) {
			int[] res = new int[n + 1];
			for (int i = 0; i < n; i++) {
				res[i + 1] = nextInt();
			}
			return res;
		}

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

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

		public long[] nextLongArray1Index(int n) {
			long[] res = new long[n + 1];
			for (int i = 0; i < n; i++) {
				res[i + 1] = nextLong();
			}
			return res;
		}

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


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

using namespace std;

int main()
{
int N;
cin >> N;
double A[N],R=0;
for(int i=0 ; i<N;i++)
{
    cin >> A[i];
}

for(int i=0 ; i<N;i++)
{
    R =R+(1/A[i]);
}
cout << 1/R;
    return 0;
}

Measured memory_bytes: 256
timo = list(map(int, input().split()))
n = timo[0]
a = timo[1]
b = timo[2]
res = 0
for i in range(1, n + 1):
  ketas = sum([int(j) for j in str(i)])
  if a <= ketas <= b:
    res += i
print(res)

Measured memory_bytes: 3064
use std::io::{BufRead, Read};

pub struct Scanner<R>
where
    R: BufRead,
{
    reader: R,
}

impl<R> Scanner<R>
where
    R: BufRead,
{
    pub fn new(reader: R) -> Self {
        Self { reader }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: ::std::str::FromStr,
        <T as ::std::str::FromStr>::Err: ::std::fmt::Debug,
    {
        self.reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .unwrap()
    }
}

fn manhattan(x: &Vec<i32>, y: &Vec<i32>) -> f64 {
    x.iter()
        .zip(y.iter())
        .map(|(x, y)| (*x - *y).abs() as f64)
        .fold(0.0, |acc, v| acc + v)
}

fn euclidean(x: &Vec<i32>, y: &Vec<i32>) -> f64 {
    x.iter()
        .zip(y.iter())
        .map(|(x, y)| ((*x - *y).abs() as f64).powi(2))
        .fold(0.0, |acc, v| acc + v)
        .sqrt()
}

fn minkowski(n: i32, x : &Vec<i32>, y: &Vec<i32>) -> f64 {
    x.iter()
        .zip(y.iter())
        .map(|(x,y)| ((*x - *y).abs() as f64).powi(n))
        .fold(0.0, |acc, v| acc + v)
        .powf(1. / n as f64)
}

fn chebyshev(x: &Vec<i32>, y: &Vec<i32>) -> f64 {
    x.iter()
        .zip(y.iter())
        .map(|(x,y)| (*x - *y).abs())
        .max()
        .unwrap() as f64
}

fn main() {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let mut sc = Scanner::new(stdin);

    let n: usize = sc.next();
    let x: Vec<i32> = (0..n).map(|_| sc.next()).collect();
    let y: Vec<i32> = (0..n).map(|_| sc.next()).collect();

    println!("{}", manhattan(&x, &y));
    println!("{}", euclidean(&x, &y));
    println!("{}", minkowski(3, &x, &y));
    println!("{}", chebyshev(&x, &y));
}



Measured memory_bytes: 5148
//#include "pch.h"
//#include "stdafx.h"
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define INF				2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define MIN(a, b)		((a) < (b) ? a : b)
#define MAX(a, b)		((a) > (b) ? a : b)
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)		/* 奇数 */
#define IsEven(x)		(!IsOdd((x)))					/* 偶数 */
#define ArrayLength(x)	(sizeof(x) / sizeof(x[0]))
#define DWORD_MAX		(0xFFFFFFFF)

typedef short SWORD;
typedef unsigned short WORD;
typedef long SDWORD;
typedef unsigned long DWORD;
typedef long long int QWORD;
typedef pair<int, int> P;

#define N_MAX	(100000)
#define M_MAX	(1000)
#define H_MAX	(1000)
#define W_MAX	(1000)

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
// メイン
typedef struct {
	int	val;
	int num;
} OKIKAE_INFO;

bool cmp(OKIKAE_INFO &a, OKIKAE_INFO &b)
{
	return a.val > b.val;
}

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

	cout << (A * 3 + B) / 2;
	cout << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

ll n;
ll check[1010];
ll root[1010];
ll x[1010];
ll y[1010];


ll ko[1010];
ll kocnt;
ll dp[5010];
void f(ll k){//頂点kの塗り方を決める

	//子孫の塗り方をチェックする
	check[k]=1;
	rep(i,0,n)if(root[i]==k&&!check[i])f(i);
	
	kocnt=0;
	rep(i,0,n)if(root[i]==k)ko[kocnt++]=i;

	//x[k]以下の最大値を探すdp
	rep(i,0,5010)dp[i]=0;
	dp[0]=1;
	
	ll base=0;
	rep(i,0,kocnt){
		base+=min(x[ko[i]],y[ko[i]]);
		ll d=max(x[ko[i]],y[ko[i]])-min(x[ko[i]],y[ko[i]]);
		for(ll j=5005;j>=d;j--)if(dp[j-d])dp[j]=1;
	}
	if(base>x[k]){
		puts("IMPOSSIBLE");
		exit(0);
	}
	for(ll j=x[k]-base;j>=0;j--)if(dp[j]){
		//j+base=Z
		//求めるのはΣX+ΣY-Z
		ll ans=-j-base;
		rep(i,0,kocnt)ans+=x[ko[i]]+y[ko[i]];
		y[k]=ans;
		break;
	}
}

int main(){
	scanf("%lld",&n);
	root[0]=-1;
	rep(i,1,n){
		ll t;
		scanf("%lld",&t);
		root[i]=t-1;
	}
	rep(i,0,n)scanf("%lld",x+i);
	
	f(0);
	puts("POSSIBLE");
//	rep(i,0,n)printf("%lld ",y[i]);
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8-*-

s = input()
n = len(s)
c0 = 0
c1 = 0
for i in s:
    if i == "0":
        c0 += 1
    else:
        c1 += 1
print(2*min(c0, c1))

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;

int n,ans;

signed main() {
    cin >> n;
    rep1(i,n) if (i%3 != 0 && i%5 != 0) ans += i;
    cout << ans << endl;
}





Measured memory_bytes: 3620
# -*- coding: utf-8 -*-
from fractions import gcd

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

if N == 2:
    print(max(A))
else:
    ans = gcd(A[0], A[1])
    ans2 = max(gcd(A[0], A[2]), gcd(A[1], A[2]))
    for a in A[2:]:
        ans2 = max(gcd(a, ans2), ans)
        ans = gcd(a, ans)
    
    print(ans2)
    

Measured memory_bytes: 16060
N, *K = $<.read.split.map(&:to_i)
if K[-1] != 2
	p~0; exit
end
z, l, u = 2, 1, 2
K.reverse_each{|a|
	z, l, u = a, (z*l+a-1)/a, (z*u+a-1)/a
	if l == u
		p~0; exit
	end
}
puts [z*l, z*u-1]*' '


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

int main() {
  long n,a,b;
  cin >> n >> a >> b;
  if(a%2==b%2) cout << (b-a)/2 << endl;
  else if(a-1<n-b) cout << a+(b-a-1)/2 << endl;
  else cout << n-b+1+(b-a-1)/2 << endl;
}

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

using namespace std;
typedef long long unsigned int ll;

int main() {
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  vector<ll> A(X);
  vector<ll> B(Y);
  vector<ll> C(Z);

  for (int i = 0; i < X; ++i) {
    cin >> A[i];
  }
  for (int i = 0; i < Y; ++i) {
    cin >> B[i];
  }
  for (int i = 0; i < Z; ++i) {
    cin >> C[i];
  }

  vector<ll> AB;
  for (int i = 0; i < X; ++i) {
    for (int j = 0; j < Y; ++j) {
      AB.push_back(A[i] + B[j]);
    }
  }
  sort(AB.rbegin(), AB.rend());

  vector<ll> ans;
  for (int i = 0; i < min(K, (int)AB.size()); ++i) {
    for (int j = 0; j < Z; ++j) {
      ans.push_back(AB[i] + C[j]);
    }
  }

  sort(ans.rbegin(), ans.rend());
  for (int i = 0; i < K; ++i) {
    cout << ans[i] << endl;
  }

  return 0;
}



Measured memory_bytes: 43240
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define Yes()           printf("Yes\n")
#define No()            printf("No\n")
#define YES()           printf("YES\n")
#define NO()            printf("NO\n")
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int a, b, c, d; cin >> a >> b >> c >> d;
  int ans = 0;

  if (a <= c && c <= b && b <= d) outl(b - c);
  else if (a <= d && d <= b && c <= a) outl(d - a);
  else if (a <= c && d <= b) outl(d - c);
  else if (c <= a && b <= d) outl(b - a);
  else outl(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc176/tasks/abc176_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int N, X, T;
    cin >> N >> X >> T;
    int a = CEIL(N, X);
    cout << a * T << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 3636
IDENTIFICATION DIVISION.
       PROGRAM-ID. ATCODER.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  indata PIC X(100).
       01  a1 PIC S9(08).
       01  a2 PIC S9(08).
       01  a3 PIC S9(08).
       01  r1 PIC S9(08).
       01  r2 PIC S9(08).
       01  r3 PIC S9(08).
       01  r pic S9(08).
       01 disp pic Z(20)9.
       PROCEDURE DIVISION.
        ACCEPT indata.
        
        UNSTRING indata DELIMITED BY SPACE INTO a1 a2 a3.
        divide a3 by a1 giving r
        compute r = r * a2

        MOVE FUNCTION TRIM(r) to disp
        DISPLAY disp

       STOP RUN.


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <set>
using namespace std;

int main() {
	string s;
	cin >> s;

	int k;
	cin >> k;

	set<string> st;
	for (int i = 1; i <= min(k, (int)s.size()); ++i) {
		for (int j = 0; j <= s.size() - i; ++j) {
			st.insert(s.substr(j, i));
		}
	}

	auto it = st.begin();
	while (--k) {
		it++;
	}

	cout << *it;
}

Measured memory_bytes: 1664
package main

import "fmt"

func main() {
	var S string
	fmt.Scan(&S)

	if judge(S) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

func judge(s string) bool {
	var Nflg, Sflg, Eflg, Wflg, NSflg, EWflg bool

	for _, v := range s {
		switch v {
		case 'N':
			Nflg = true
		case 'E':
			Eflg = true
		case 'S':
			Sflg = true
		case 'W':
			Wflg = true
		}
	}
	if (Nflg && !Sflg) || (!Nflg && Sflg) {
		NSflg = true
	}
	if (Eflg && !Wflg) || (!Eflg && Wflg) {
		EWflg = true
	}
	if NSflg || EWflg {
		return false
	}
	return true
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111
	
	int dp[310000];

	
	void solve(){


		ini(n);
		ini(n1);
		dp[0] = 0;
		FOR(i,0,n){
			ini(x,x1);
			if(x1>n1)continue;
			FOR(i1,0,n1-x1+1){
				dp[i1+x1] = max(dp[i1+x1],dp[i1]+x);
				//out(x,i1+x1,dp[i1+x1]);
			}
		}
		int rick = 0;
		FOR(i,0,n1+1){
			rick =max(rick,dp[i]);
		}
		out(rick);

		


		
		
	}























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}



Measured memory_bytes: 3288
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
#define rep(src,dst)    for(int i=src; i<dst;  i++)
#define rep2(src,dst)   for(int j=src; j<dst;  j++)
#define INF 1000000000000 //1e+12
#define MOD 10000007 //1e9+7
#define PI  acos(-1)
#define ll long long
template<typename T> inline void cMin(T* a, T* b) {if(*a>*b) *a=*b;}
template<typename T> inline void chMax(T* a, T* b) {if(*a<*b) *a=*b;}
template<typename T> inline int  divUp(T a, T b)   {return ((a+b-1)/b);}

int main(){
    int n; cin >> n;
    int d; cin >> d;
    int ans=0;
    double x, y;

    rep(0,n){
        cin >> x >> y;
        double tmp = x*x + y*y;
        if(sqrt(tmp) <= d) ans++;
    }
    cout << ans << endl;
    return 0;
}
/*

*/


Measured memory_bytes: 3780
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <vector>
using namespace std;
int a[50],b[50],c[50];
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        c[a[i]-1]++;
        c[b[i]-1]++;
    }
    for(int i=0;i<n;i++)cout<<c[i]<<endl;
    return 0;
}


Measured memory_bytes: 256
a = list(map(int, input().split()))
num = int(input())
k = 0
for i in range(num):    #num回２倍を繰り返す。でなければNoをprint
  if a[0] == max(a) or a[1] == max(a):   #リストaの中のmaxよりも青が小さいならば青を二倍する
    a[2] = a[2] * 2
    k += 1
  elif a[1] == min(a) and k < num:
    a[1] = a[1] * 2
    k += 1 
  else:
    pass

if a[0] < a[1] and a[1] < a[2]:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 200100;


template <int mod>
struct ModInt{
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p){
        if ((x += p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p){
        if ((x += mod - p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p){
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p){
        *this *= p.inverse();
        return *this;
    }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while (b > 0){
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }

    ModInt pow(int e){
        long long a = 1, p = x;
        while (e > 0){
            if (e % 2 == 0){
                p = (p * p) % mod;
                e /= 2;
            }
            else{
                a = (a * p) % mod;
                e--;
            }
        }
        return ModInt(a);
    }

    friend ostream &operator<<(ostream &os, const ModInt<mod> &p){
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a){
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

using modint = ModInt<mod>;
modint f[d5];

void makef(){
    f[0] = 1;
    for (int i = 1; i < d5; i++)
        f[i] = f[i - 1] * i;
}

modint nCr(int n, int r){
    if (n < r || r < 0)
        return 0;
    return f[n] / (f[r] * f[n - r]);
}

int beki(int a, int b){
    a %= mod;
    if(b==0)return 1;
    int ans=beki(a,b/2);
    ans=ans*ans%mod;
    if(b%2==1)ans=ans*a%mod;
    return ans;
}

int combination(int a, int b){
    if((a==b)||(b==0)) return 1;
    if(a<b) return 0;
    int ret=1;
    for(int i=0;i<b;i++) {
        ret*=(a-i);
        ret%=mod;
        ret*=beki(i+1,mod-2);
        ret%=mod;
    }
    return ret;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    modint res=0;
    if(n<k){
        cout<<1<<endl;
        return 0;
    }
    int m=0,M=n;
    for(int i=1;i<k;i++){
        m+=i;
        M+=n-i;
    }
    for(int i=k;i<=n;i++){
        res+=M-m+1;
        m+=i;
        M+=n-i;
    }
    res+=(M-m+1);
    cout<<res<<endl;
}

Measured memory_bytes: 5216
N = int(input())
S = list(input())
K = int(input())
char = S[K-1]
n = 0
for N in S:
    if S[n] != char:
        S[n] = '*'
        n += 1
    else:
        n +=1
        
S_ = ''.join(S)
print(S_)

Measured memory_bytes: 3060
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    var count = 0;
    for (i in 1..n step 2) {
        var divisor = 0
        for (j in 1..n step 2) {
            if (i % j == 0) {
                if (divisor == 8) {
                    divisor = -1
                    break
                }
                divisor++
            }
        }
        if (divisor == 8) {
            count++
        }
    }

    println(count)
}

Measured memory_bytes: 32036
<?php
fscanf(STDIN, "%d", $t);
fscanf(STDIN, "%s", $s);
$len = $t / 2;
$a = substr($s, 0, $len);
$a = $a . $a;

if ($a === $s) {
  echo 'Yes';
} else {
  echo 'No';
}


Measured memory_bytes: 4728
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()))
    p = C
    for j in range(M):
        p += A[j] * B[j]
    if p > 0:
        count += 1

print(count)

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> ii;
typedef complex<ld> cp;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<cp> vcp;
typedef vector<ld> vld;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vii> vvii;

#define fastIO ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define forw(i,l,r) for( int i = (l) ; i < (r) ; i++ )
#define forb(i,r,l) for( int i = (r) ; i >= (l) ; i-- )
#define log2i(x) (32 - __builtin_clz((x)) - 1)
#define log2ll(x) (64 - __builtin_clzll((x)) - 1)
#define Pi acos(-1.0)
#define sz(x) (int)x.size()
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

const int mod = 1e9+7;
const int N = 1e6+7;
int n;
ll dp[N][4];

int main() {
#ifndef ONLINE_JUDGE
    //freopen("test.inp","r",stdin);
    //freopen("test.out","w",stdout);
#endif
    fastIO;
    cin >> n;
    dp[0][0]=1;
    forw(i,1,n+1) {
        dp[i][0]=8*dp[i-1][0]%mod;
        dp[i][1]=(dp[i-1][0]+9*dp[i-1][1])%mod;
        dp[i][2]=(9*dp[i-1][2]+dp[i-1][0])%mod;
        dp[i][3]=(dp[i-1][1]+dp[i-1][2]+10*dp[i-1][3])%mod;
    }
    cout << dp[n][3];
    return 0;
}


Measured memory_bytes: 34800
//#define DEBUG
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std;

#define BSET(a, p) ((a) | (1ll << (p)))
#define BCHK(a, p) ((a) & (1ll << (p)))
#define BXOR(a, p) ((a) ^ (1ll << (p)));
#define BREM(a, p) (BCHK(a, p)?(BXOR(a, p)):(a))
#define BSHO(a, N) (bitset<N>(a))

#define fi first
#define sc second 
#define pb push_back


#ifdef DEBUG
    #define dbg(s) {s;}
    #define PRELUDE
#endif

#ifndef DEBUG 
    #define PRELUDE { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
    #define dbg(s)
    #define endl "\n"
#endif

#define int ll
#define i32 int32_t

#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update> 
// Ordered set docs:
// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).

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

typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;

// To remove randomization use 0 below:
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline int ri(int x) { // from [0, n-1]
    return uniform_int_distribution<int>(0, x - 1)(rng);
}

inline ld rf() { // from [0, 1]
    return uniform_real_distribution<ld>(0, 1)(rng);
}

ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
} 

const ll mod = 1e9 + 7;

ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}

const int maxn = 1e2 + 7;

const ll inf = 1e9 + 7;

int board[maxn][maxn];
int dp[maxn][maxn];
int r,c;
void solve()
{
    memset(board,0,sizeof(board));

    cin>>r>>c;

    for(int i=0;i<=r;i++)
    {
        for(int j=0;j<=c;j++)
            dp[i][j] = inf;
    }
    char x;
    for(int i=1;i<=r;i++)
    {
        for(int j=1;j<=c;j++)
        {
            cin>>x;
            if(x=='#')
                board[i][j] = 1;
        }
    }
    dp[1][1] = board[1][1];

    for(int i=1;i<=r;i++)
    {
        for(int j=1;j<=c;j++)
        {
            if(i==1 && j==1)
                continue;
            if(board[i][j]==0)
            {
                dp[i][j] = min(dp[i-1][j],dp[i][j-1]);
            } else{
                if(board[i-1][j]==1)
                    dp[i][j] = min(dp[i][j],dp[i-1][j]);
                else
                    dp[i][j] = min(dp[i][j],dp[i-1][j]+1);
                if(board[i][j-1]==1)
                    dp[i][j] = min(dp[i][j],dp[i][j-1]);
                else
                    dp[i][j] = min(dp[i][j],dp[i][j-1]+1);
            }
            //cout<<dp[i][j]<<" ";
        }
        //cout<<endl;
    }

    cout<<dp[r][c]<<endl;
}

i32 main() {
    //freopen("<file>.in", "r", stdin);
    //freopen("<file>.out", "w", stdout);
    
    PRELUDE;
    int t = 1;
    //cin>>t;
    while(t--)
        solve();
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

class UF {
private:
	std::vector<int> parent;
	std::vector<int> level;
	std::vector<int> num_member; // 同じグループに属するメンバーの数
								 // 自身込み

public:
	// コンストラクタ　※注意※　0～nまでのn+1個を作る
	UF(int n) {
		for (int i = 0; i <= n; i++) {
			parent.push_back(i); //
			level.push_back(1);  // 木の深さ
			num_member.push_back(1);
		}
	}
	// 木の根を求める
	int root(int x) {
		if (parent[x] == x)return x;
		else return parent[x] = root(parent[x]);
	}

	// 同じ集合に属するメンバーの数を求める
	int numOfmember(int x) {
		if (parent[x] == x) return num_member[x];
		else return num_member[x] = numOfmember(parent[x]);
	}

	// xとyの属する集合を合併
	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry) return; // 元々合併済みの場合
		if (level[rx] < level[ry]) {
			num_member[ry] = numOfmember(ry) + numOfmember(rx);
			parent[rx] = ry;
		}
		else {
			num_member[rx] = numOfmember(ry) + numOfmember(rx);
			parent[ry] = rx;
			if (level[rx] == level[ry]) level[rx]++;
		}
	}
	// xとyが同じ集合に属するか否か
	bool same(int x, int y) {
		return root(x) == root(y); // rootが同じなら同じ集合に含まれる
	}
};

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

	int N, K, L; cin >> N >> K >> L;

	UF roadConnect(N);
	UF trainConnect(N);

	for (int i = 0; i < K; i++) {
		int p, q; cin >> p >> q;
		roadConnect.unite(p, q);
	}

	for (int i = 0; i < L; i++) {
		int r, s; cin >> r >> s;
		trainConnect.unite(r, s);
	}

	map<P,int> M;
	for (int i = 1; i <= N; i++) M[P(roadConnect.root(i), trainConnect.root(i))]++;

	for (int i = 1; i <= N; i++) {
		cout << M[P(roadConnect.root(i), trainConnect.root(i))] << " ";
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 16608
import java.util.Scanner;


public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	boolean t = false;
	int N = sc.nextInt();
	for(int i=0;i < N;i++){
		String co = sc.next();
		if(co.equalsIgnoreCase("Y"))
			t = true;
	}
	
	if(t == false){
		System.out.println("Three");
	}else{
		System.out.println("Four");
	}
}
}


Measured memory_bytes: 22868
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
using namespace std;

typedef long long int ll;
typedef long double ld;



int main(){
    string a;
    cin >> a;
    a[5]=' ';
    a[13]=' ';
    cout << a << endl;
}


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

int main(){
    int mat[3][3] = {};
    int minimum = 101;
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> mat[i][j];
            minimum = min(minimum, mat[i][j]);
        }
    }

    int m = max(mat[0][0], max(mat[1][0], mat[2][0]));

    for(int b1 = 0; b1 <= min(100, minimum); b1++){
        int a1 = mat[0][0]-b1;
        int a2 = mat[1][0]-b1;
        int a3 = mat[2][0]-b1;
        if(mat[0][1]-a1 == mat[1][1]-a2 && mat[1][1]-a2 == mat[2][1]-a3 &&
           mat[0][2]-a1 == mat[1][2]-a2 && mat[1][2]-a2 == mat[2][2]-a3){
               cout << "Yes" << endl;
               return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256