akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>

#define MA 114514810

using namespace std;
int prime[MA];

bool is_prime(int n) {
    for(int i=2; i*i <= n; i++) {
        if(n % i == 0)
            return false;
    }
    return true;
}

void init() {
    int cnt=0;
    prime[cnt++] = 2;
    for(int i=3; cnt<10000; i++) {
        if(is_prime(i))
            prime[cnt++] = i;
    }
}

int main(void)
{
    int n;
    init();

    while(1) {
        scanf("%d", &n);
        if(n==0) break;

        int sum = 0;
        for(int i=0; i<n; i++)
            sum += prime[i];
        printf("%d\n", sum);
    }

    return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <bitset>
#include <algorithm>

std::bitset<4000000>b[2];

signed main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout.tie(0);
	
	int n;
	std::cin >> n;
	
	int a[n];
	for(int i = 0; i < n; i++)
		std::cin >> a[i];
	
	std::sort(a, a+n);
	
	long long sum = 0;
	for(int i = 0; i < n; i++)
		sum += a[i];
	
	b[0].set(0,1);
    b[0].set(a[0],1);
    for(int i = 1; i < n; i++)
    {
        b[i&1]=b[i&1]|b[!(i&1)];
        b[i&1]=b[i&1]|(b[!(i&1)]<<a[i]);
    }
    sum++;
    sum/=2;
    for(long long i = sum; i < 2*sum + 5; i++) {
		if(b[(n-1)&1][i]) {
			std::cout << i << std::endl;
			return 0;
		}
    }
    
    return 0;
}


Measured memory_bytes: 3200
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();


		if((a == b + c) || (b == c + a)|| (c == a + b))
		{
			System.out.println("Yes");
		}else
		{
			System.out.println("No");
		}



	}

}


Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//

ll n, m;
vector<vector<ll> > g;
vector<ll> num;
ll dp[100100];

int main() {
    cin >> n >> m;
    g.assign(n, vector<ll>());
    num.assign(n, 0);
    for(int i = 0; i < m; i++){
        ll x, y;
        cin >> x >> y;
        x--; y--;
        g[x].push_back(y);
        num[y]++;
    }

    queue<ll> que;
    for(int i = 0; i < n; i++) if(num[i] == 0) que.push(i);

    while(!que.empty()){
        ll i = que.front(); que.pop();

        for(auto j : g[i]){
            num[j]--;
            if(num[j] == 0) {
                que.push(j);
                dp[j] = max(dp[j], dp[i] + 1);
            }
        }
    }

    ll res = 0;
    for(int i = 0; i < n; i++) res = max(res, dp[i]);

    cout << res << endl;
}

Measured memory_bytes: 7296
class Dice:
    def __init__(self, dice):
        self.dice = dice
        self.buff = [n for n in dice]
    def east(self):
        self.dice[0] = self.buff[3]
        self.dice[2] = self.buff[0]
        self.dice[5] = self.buff[2]
        self.dice[3] = self.buff[5]
        self.buff = [n for n in self.dice]
    def west(self):
        self.dice[0] = self.buff[2]
        self.dice[2] = self.buff[5]
        self.dice[5] = self.buff[3]
        self.dice[3] = self.buff[0]
        self.buff = [n for n in self.dice]
    def north(self):
        self.dice[0] = self.buff[1]
        self.dice[1] = self.buff[5]
        self.dice[5] = self.buff[4]
        self.dice[4] = self.buff[0]
        self.buff = [n for n in self.dice]
    def south(self):
        self.dice[0] = self.buff[4]
        self.dice[1] = self.buff[0]
        self.dice[5] = self.buff[1]
        self.dice[4] = self.buff[5]
        self.buff = [n for n in self.dice]
    def isSameDice(self, anotherDice):
        if \
        self.dice[0] == anotherDice.dice[0] and \
        self.dice[1] == anotherDice.dice[1] and \
        self.dice[2] == anotherDice.dice[2] and \
        self.dice[3] == anotherDice.dice[3] and \
        self.dice[4] == anotherDice.dice[4] and \
        self.dice[5] == anotherDice.dice[5]:
            return True
        return False


import random

nums1 = list(map(int, input().split()))
nums2 = list(map(int, input().split()))
dice1 = Dice(nums1)
dice2 = Dice(nums2)

flag = False
# rotate dice2 to random directions many times
# until we get the coincident between the two dices.
for i in range(1000):
    k = random.randint(0, 4)
    if k == 0:
        dice2.east()
    elif k == 1:
        dice2.west()
    elif k == 2:
        dice2.north()
    else:
        dice2.south()
    if dice2.isSameDice(dice1):
        flag = True
        break

if flag:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 8204
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Printer{
    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T>
    void print(vector<T> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class T>
    void print(vector<vector<T> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};
using namespace Printer;

//--global--//

vector<bool> sieve(long long max){ // 0 <= x <= max までの素数を調べ、返す。
    vector<bool> isPrime;
    
    if(max+1 > isPrime.size()){     // resizeで要素数が減らないように
        isPrime.resize(max+1,true); // isPrimeに必要な要素数を確保
    } 
    isPrime[0] = false; // 0は素数ではない
    isPrime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(isPrime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                isPrime[i*j] = false;      // 素数ではない
    
    return isPrime;
}

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

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    ll n;
    cin >> n;
    const int fiveMax = 55555;
    vector<bool> isPrime;
    isPrime = sieve(fiveMax);
    vector<int> primeNums;
    rep(i, fiveMax+1){
        if(isPrime[i]){
            primeNums.push_back(i);
        }
    }
    vector<int> ans;
    for(int x : primeNums){
        if(x % 5 == 1){
            ans.push_back(x);
        }
    }
    rep(i, n){
        if(i) cout << " ";
        cout << ans[i];
    }
    cout << endl;
    
    
    return 0;
}


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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORE(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SP cout << fixed << setprecision(10)
typedef pair<int, int> P;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

    int n;
    cin >> n;
    int w[n];
    rep(i, n) cin >> w[i];

    int minabs = INF;
    int sum1 = 0, sum2 = 0;
    rep(i, n) {
        rep(j, n) {
            if (j <= i)
                sum1 += w[j];
            else
                sum2 += w[j];
        }
        minabs = min(abs(sum1 - sum2), minabs);
        sum1 = 0, sum2 = 0;
    }

    cout << minabs << endl;

    return 0;
}

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

int main() {
    int x, t; cin >> x >> t;
    cout << max(0,x-t) << endl;
}

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

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vector <int> > vvi;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);


typedef pair<int,bool> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,C;
    cin >> N >> C;
    N++;//自分を入れる
    int sum = 0;
    REP(i,C){
        int p;
        cin >> p;
        sum += p;
    }
    int ans = sum / N;
    if(sum % N != 0)ans++;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3140
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let (n, k): (usize, usize) = read();

    println!("{}", (n-1+k-2)/(k-1));
}


Measured memory_bytes: 4476
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  string s;
  int k,dp[105][2][105]={},ans=0;
  cin >> s >> k;
  dp[0][0][0]=1;
  for(int i=0; i<s.size(); i++) {
    for(int j=0; j<2; j++) {
      for(int l=0; l<105; l++) {
        int lim=j?9:s[i]-'0';
        for(int m=0; m<=lim; m++) {
          dp[i+1][j||m<lim][l+(m!=0)]+=dp[i][j][l];
        }
      }
    }
  }
  for(int i=0; i<2; i++) {
    ans+=dp[s.size()][i][k];
  }
  cout << ans << "\n";
}


Measured memory_bytes: 384
fn main() {
    proconio::input! {
        k: usize,
        t: usize,
        mut a_s: [usize; t],
    }
    let mut count = 0;
    let mut prev: usize = a_s.iter().enumerate().max_by_key(|(_i, a)| *a).unwrap().0;
    a_s[prev] -= 1;
    for _ in 0..k {
        if a_s.iter().all(|a| *a == 0) {
            break;
        }
        if let Some((max_position, _)) = a_s
            .iter()
            .enumerate()
            .filter(|(i, a)| *i != prev && **a != 0)
            .max_by_key(|(_i, a)| *a)
        {
            a_s[max_position] -= 1;
            prev = max_position;
        } else {
            a_s[prev] -= 1;
            count += 1;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 2152
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        sc.close();
        int sum = 0;
        for (int i = 1; i <= k; i++) {
            for (int j = 1; j <= k; j++) {
                for (int m = 1; m <= k; m++) {
                    sum += gcd(gcd(i,j), m);
                }
            }
        }
        System.out.println(sum);
    }
    // GCD
    public static int gcd(int m, int n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
}

Measured memory_bytes: 35900
#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
  map<string, string> wf = { { "Sunny", "Cloudy" },
                            { "Cloudy", "Rainy" },
                            { "Rainy", "Sunny" }};
  string s;
  cin >> s;
  cout << wf[s] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
  int a,b,d,r;
  double f;
  scanf("%d %d",&a,&b);
  d=a/b;
  r=a%b;
  f=(double)a/b;
  printf("%d %d %lf\n",d,r,f);
  return(0);
}

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

ll add[3] = {-1, 0, 1};

void dfs(ll num, vector<ll> &ans, int keta) {
    ans.push_back(num);

    if (keta == 10) {
        return;
    }

    for (int i = 0; i < 3; i++) {
        ll ad = (num % 10) + add[i];
        if (ad < 0 || ad > 9)
            continue;
        dfs(num * 10 + ad, ans, keta + 1);
    }
}

int main() {
    int K;
    cin >> K;
    vector<ll> ans;
    for (int i = 1; i < 10; i++) {
        ll num = i;
        int keta = 0;
        dfs(num, ans, keta);
    }

    sort(all(ans));
    cout << ans[K - 1] << endl;
}

Measured memory_bytes: 11656
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt()-1;
        int k=sc.nextInt();
        int[]po=new int[k];
        for(int i=0;i<k;i++)po[i]=sc.nextInt();
        Arrays.sort(po);
        int p[]=new int[k-1];
        for(int i=0;i<k-1;i++)p[i]=po[i+1]-po[i];
        Arrays.sort(p);
        int ans=po[k-1]-po[0];
        if(n>=k+1)System.out.println(0);
        else{
            for(int i=0;i<n;i++)ans-=p[k-2-i];
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 50200
#include<iostream>
using namespace std;
main(){
  int n,m;
  char masu[1002][1002];
  int mem[1002][1002]={0};
  char monsyou[3][3];
  int before=0,after=0;
  char joi[3]={'J','O','I'};
  int ihu[4]={-1,-1,0,0};
  int jhu[4]={-1,0,-1,0};
  int imu[4]={-1,-1,0,0};
  int jmu[4]={0,1,0,1};
  int ihs[4]={0,0,1,1};
  int jhs[4]={-1,0,-1,0};
  int ims[4]={0,0,1,1};
  int jms[4]={0,1,0,1};
  cin>>n>>m;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin>>masu[i][j];
    }
  }
  for(int i=0;i<2;i++){
    for(int j=0;j<2;j++){
      cin>>monsyou[i][j];
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      for(int k=0;k<4;k++){
	if(masu[i+ihu[k]][j+jhu[k]]==monsyou[0][0]&&masu[i+imu[k]][j+jmu[k]]==monsyou[0][1]&&masu[i+ihs[k]][j+jhs[k]]==monsyou[1][0]&&masu[i+ims[k]][j+jms[k]]==monsyou[1][1]){
	  before=before+1;
	  mem[i][j]=mem[i][j]+1;
	}
      }
    }
  }
  if(before!=0){
    before=before/4;
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      char kioku;
      kioku=masu[i][j];
      for(int a=0;a<3;a++){
	if(masu[i][j]!=joi[a]){
	  int count=0;
	  masu[i][j]=joi[a];
	  for(int k=0;k<4;k++){
	    if(masu[i+ihu[k]][j+jhu[k]]==monsyou[0][0]&&masu[i+imu[k]][j+jmu[k]]==monsyou[0][1]&&masu[i+ihs[k]][j+jhs[k]]==monsyou[1][0]&&masu[i+ims[k]][j+jms[k]]==monsyou[1][1]){
	      count=count+1;
	    }
	  }
	  masu[i][j]=kioku;
	  if(count-mem[i][j]>after){
	    after=count-mem[i][j];
	  }
	}
      }	
    }
  }
  cout<<before+after<<endl;
  return 0;
}

Measured memory_bytes: 6072
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
#define rep(i, s, n) for(i64 i=(s); i < (n); ++i)
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD  = int(1e9) + 7;

signed main()
{
  int x, y;
  cin >> x >> y;
  cout << (x + y/2) << endl;
  return 0;
}



Measured memory_bytes: 256
import math

n=int(input())
X=input().split()
Y=input().split()
x=[0 for i in range(n)]
y=[0 for i in range(n)]
for i in range(n):
    x[i]=int(X[i])
for i in range(n):
    y[i]=int(Y[i])
sum_1=0
for i in range(n):
    sum_1=sum_1+abs(x[i]-y[i])
D_1=sum_1

sum_2=0
for i in range(n):
    sum_2=sum_2+((x[i]-y[i])**2)
D_2=math.sqrt(sum_2)

sum_3=0
for i in range(n):
    sum_3=sum_3+abs(x[i]-y[i])**3
D_3=sum_3**(1/3)
Abs=[abs(x[i]-y[i]) for i in range(n)]
max=max(Abs)
print(f"{D_1} {D_2} {D_3} {max}")



Measured memory_bytes: 5724
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());

        int H = Integer.parseInt(st.nextToken());
        int W = Integer.parseInt(st.nextToken());
        int K = Integer.parseInt(st.nextToken());

        char map[][];
        map = new char[H][W];

        int ans = 0;

        for(int i = 0; i < H; i++) {
            st = new StringTokenizer(br.readLine());
            String str = st.nextToken();
            for(int j = 0; j < W; j++) {
                map[i][j] = str.charAt(j);
            }
        }

        for(int i = 0; i < (1 << H); i++) {
            for(int j = 0; j < (1<<W); j++) {

                int mark = 0;

                for(int k = 0; k < H; k++) {
                    if((i>>k & 1) == 1) continue;
                    for(int l = 0; l < W; l++) {
                        if((j>>l & 1) == 1) continue;
                        if(map[k][l] == '#') mark++;
                    }
                }

                if(mark == K) ans++;
            }
        }

        pw.println(ans);
        br.close();
        pw.close();
    }
}

Measured memory_bytes: 32744
N,Q = map(int,input().split())
S = input()
a = [list(map(int,input().split())) for i in range(Q)]
p = [0]
q=0
for i in range(N-1):
    if S[i]=='A' and S[i+1]=='C':
        q+=1
        p.append(q)
    else:
        p.append(p[i])
for j in range(Q):
    
    print(p[a[j][1]-1]-p[a[j][0]-1])

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

int calc_score() {
    int out = 0;
    char str[100];
    int score = 0;
    int base = 0;

    while (out < 3) {
        scanf("%s", str);
        switch (str[1]) {
        case 'U':
            out++;
            break;
        case 'I':
            if (base == 3) {
                score++;
            } else {
                base++;
            }
            break;
        case 'O':
            score += (base + 1);
            base = 0;
            break;
        }
    }
    return score;
}

int main(void) {
    int n;
    int inning = 0;

    scanf("%d", &n);

    while (inning < n) {
        printf("%d\n", calc_score());
        inning++;
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, a;
	cin>>n>>k;
	cin>>a;
	int tmp=a, ma=a;
	REP(i, n-1){
		cin>>a;
		tmp=gcd(tmp, a);
		ma=max(ma, a);
	}
	if(ma<k || k%tmp){
		cout<<"IM";
	}
	cout<<"POSSIBLE"<<'\n';
	return 0;
}


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

using namespace std;

int main() {
    int N, D;
    cin >> N >> D;
    if ( N% (2*D+1) == 0 ) {
        cout << int(N/ (2*D+1)) << endl;
    } else {
        cout << int(N/ (2*D+1)) + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, s, e) for(int i=s; i<e; i++)
#define REF(i, s, e) for(int i=s; i>e; i--)
typedef long long ll;


int main(void){
    // Your code here!
    int a, b, t;
    cin >> a >> b >> t;
    
    int count = int(t/a) * b;
    cout << count << endl;
    
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int a,b;
  scanf("%d %d",&a,&b);

  int keta_b = 1;
  int temp_b = b;
  int num = 0;

  for(int i=0; i<2; i++){
    if((temp_b/10) != 0){
      temp_b /= 10;
      keta_b ++;
    }
  }
//  printf("%d %d",a,b);

  num = a;
  for(int i=0; i<keta_b; i++){
    num *= 10;
  }
  num += b;

  for(int i=0; i<320; i++){
    if(num == i*i){
      printf("Yes");
      return 0;
    }
  }
  printf("No");
}



Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
    int h,w;
    cin >> h >> w;
    while(h!=0){
        int i,j;
        for(i=0;i<h;i++){
            for(j=0;j<w;j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
        cin >> h >> w;
    }
    return 0;
}



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

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

  int max_distance = K - A[N - 1] + A[0];
  for (int i = 1; i < N; i++) {
    if (A[i] - A[i - 1] > max_distance) {
      max_distance = A[i] - A[i - 1];
    }
  }

  cout << K - max_distance << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
double ans = 0;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		double x;
		string u;
		cin >> x >> u;
		if (u == "JPY")ans += x;
		else ans += (x*380000.0);
	}
	cout << ans << endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const ll Inf = 1e18;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    ll a, b, k;
    cin >> a >> b >> k;
    if (a >= k) {
        a -= k;
    } else if (k <= a + b) {
        b -= (k - a);
        a = 0;
    } else {
        a = 0, b = 0;
    }
    cout << a << " " << b << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
#define EPS (1e-10)
#define equal(a,b)  fabs((a)-(b))<EPS
using namespace std;
struct Point{
	double x,y;
	Point(double _x,double _y):x(_x),y(_y){  }
	Point operator + (const Point &a){
		return Point(x+a.x,y+a.y);
	}
	Point operator - (const Point &a){
		return Point(x-a.x,y-a.y);
	}
	Point operator *(double k){
		return Point (k*x,k*y);
	}
	Point operator /(double k){
		return Point(x/k,y/k);
	}
	
	friend double norm(const Point &a){
		return a.x*a.x+a.y*a.y;
	}
	friend double abs(const Point &a){
		return sqrt(norm(a));
	}
	
	friend double dot(const Point &a,const Point &b){
		return a.x*b.x+a.y*b.y;
	}
	friend double cross(const Point &a,const Point &b){
		return fabs(a.x*b.y-b.x*a.y);
	}
};
typedef Point Vector;
bool isOrthogonal(const Vector &a,const Vector & b){
	return equal(cross(a,b),0.0);
}
bool isParallel(const Vector &a,const Vector &b){
	return equal(dot(a,b),0.0);
}

int main(){
	int x1,x2,y1,y2,q;
	cin>>x1>>y1>>x2>>y2>>q;
	Point a(x1,y1),b(x2,y2);
	while(q--){
		int x3,y3;
		cin>>x3>>y3;
		Point c(x3,y3);
		double t=dot(c-a,b-a)/abs(b-a);
		Vector det= (b-a) / abs(b-a) *t;
		Point ort=a+det;
		printf("%.10f %.10f\n",ort.x,ort.y);
	}
	return 0;
}


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  int N,X,T;
  cin>>N>>X>>T;
  cout << (N+X-1)/X*T << endl;
  return 0;
}



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

int main()
{
	int a[] = { 0,1,3,1,2,1,2,1,1,2,1,2,1 };

	int r,g;

	cin >> r >> g ;

	if (a[r]==a[g]) {
		cout << "Yes" << endl;
	}

	else{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a=0;
  int b=0;
  int c=0;
  int d=0;
  int e=0;
  scanf("%d %d %d",&a,&b,&c);
  for(d=a;d<b+1;d++){
    if(c%d==0){
      e=e+1;
    }
  }
  printf("%d\n",e);
  return 0;
}

Measured memory_bytes: 596
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
print(s.replace(',', ' '))

Measured memory_bytes: 74540
n, d = map(int, input().split())
l = []
ans = 0
for i in range(n):
  l.append(list(map(int, input().split())))
for i in range(n):
  for j in range(i + 1, n):
    key = 0
    for k in range(d):
      key += (l[i][k] - l[j][k]) ** 2
    if key ** 0.5 == int(key ** 0.5):
      ans +=1
    
print(ans)

Measured memory_bytes: 3064
while True:
    N, M, P, A, B = map(int, input().split())
    if not (N | M | P | A | B):
        break
    A, B = A - 1, B - 1
    T = [int(x) for x in input().split()]
    dp = [[float("inf")] * M for _ in range(1 << N)]
    dp[0][A] = 0
    D = [[float('inf')] * M for _ in range(M)]
    for _ in range(P):
        s, t, c = map(int, input().split())
        s, t = s - 1, t - 1
        D[s][t] = D[t][s] = c

    for state in range(1 << N):
        for i in range(M):
            for j in range(M):
                for k in range(N):
                    if not (state >> k & 1):
                        next_s = state | (1 << k)
                        dp[next_s][j] = min(dp[next_s][j], dp[state][i] + D[i][j] / T[k])
    ans = float('inf')
    for state in range(1 << N):
        ans = min(ans, dp[state][B])
    print("Impossible" if ans == float("inf") else "{:.020f}".format(ans))

Measured memory_bytes: 8040
n,k=map(int,input().split())
lst=[]
for m in range(1,n+1):
  a=1
  cnt=0
  for i in range(100000):
    if m*a>=k:
      lst.append(cnt)
      break
    else:
      a*=2
      cnt+=1
totl=0
for j in range(n):
  totl+=0.5**lst[j]
print(totl/n)
  
  
  


Measured memory_bytes: 3864
//
// Created by keane on 19-6-16.
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e3+50;
const ll mod=1e9+7;
int n,m;
int a[N],b[N];
ll dp[N][N];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) {
        scanf("%d", &a[i]);
    }
    for(int i=1;i<=m;i++) {
        scanf("%d",&b[i]);
    }
    for(int i = 1 ; i <= n ; i++){
        for(int j = 1 ; j <= m ; j++){
            if( a[i] == b[j] ){
                dp[i][j] = dp[i-1][j] + dp[i][j-1] + 1;
            }else {
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
            }
            dp[i][j] %= mod;
        }
    }
    printf("%lld\n",(dp[n][m]+1 + mod)%mod);
}

Measured memory_bytes: 33024
#include<iostream>
#include<set>
#include<string>
using namespace std;
int main(){
    cin.tie(0),ios_base::sync_with_stdio(false);
    string S,d{"abcdefghijklmnopqrstuvwxyz"s};
    cin>>S;
    for(auto& x:S){
        auto pos{d.find(x)};
        if(pos!=string::npos)
            d.erase(pos,1);
    }
    if(d.size())cout<<d[0]<<endl;
    else cout<<"None"<<endl;
}


Measured memory_bytes: 512
a=int(input())
n=list(map(int,input().split()))
ans=0
for i in range(1,a-1):
    if n[i-1]<n[i] and n[i]<n[i+1]:
        ans+=1
    elif n[i-1]>n[i] and n[i]>n[i+1]:
        ans+=1
print(ans)


Measured memory_bytes: 3060
S = input()
K = int(input())
lst = []

cnt = 1
ans = 0
if (len(S) != 1):
  for i in range(len(S)-1):
    if (S[i] == S[i+1]):
      cnt += 1
      if (i == len(S)-2):
        lst.append(cnt)
    else:
      lst.append(cnt)
      cnt = 1
      
  if (len(lst) == 1):
    ans = len(S)*K // 2
  else:
    for i in lst:
      ans += i // 2
    ans *= K
    
    if (S[0] == S[-1] and lst[0] % 2 != 0 and lst[-1] % 2 != 0):
      ans += K-1
else:
  ans = K // 2
print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll H,W;
  cin >> H >> W;
  ll a,b,c;
  ll ans=INF;
  for(int i=1;i<H;i++){
    a=i*W;
    b=(H-i)/2*W;
    c=(H-i-(H-i)/2)*W;
    ans=min(ans,max({a,b,c})-min({a,b,c}));
  }
  for(int i=1;i<H;i++){
    a=i*W;
    b=W/2*(H-i);
    c=(W-W/2)*(H-i);
    ans=min(ans,max({a,b,c})-min({a,b,c}));
  }
  int t;
  t=H;
  H=W;
  W=t;
  for(int i=1;i<H;i++){
    a=i*W;
    b=(H-i)/2*W;
    c=(H-i-(H-i)/2)*W;
    ans=min(ans,max({a,b,c})-min({a,b,c}));
  }
  for(int i=1;i<H;i++){
    a=i*W;
    b=W/2*(H-i);
    c=(W-W/2)*(H-i);
    ans=min(ans,max({a,b,c})-min({a,b,c}));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

vbo prime(1e6+10,false);

bool factorization(ll x){
    for(ll i=2;i*i<=x;i++){
        if(x%i==0){
            if(prime[i])return false;
            prime[i]=true;
            while(x%i==0)x/=i;
        }
    }
    if(x!=1){
        if(prime[x])return false;
        prime[x]=true;
    }
    return true;
}

int main(){
    int n;cin>>n;
    ll p=(ll)0;
    vll a(n);
    rep(i,n){
        cin>>a[i];
        p=__gcd(p,a[i]);
    }
    if(p!=1)cout<<"not coprime"<<endl;
    else{
        rep(i,n){
            if(!factorization(a[i])){
                cout<<"setwise coprime"<<endl;
                return 0;
            }
        }
        cout<<"pairwise coprime"<<endl;
    }
    //cout<<pr.size()<<endl;
}

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

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    int n, m;
    cin >> n >> m;
    vector<int> ac(n);
    vector<int> wa(n);
    int p;
    string s;
    int ansa = 0;
    rep(i, m) {
        cin >> p >> s;
        if(!ac[p-1]) {
            if(s == "AC") {
                ansa++;
                ac[p-1] = 1;
            } else if(s=="WA"){
                wa[p-1]++;
            }
        }
    }

    int answ = 0;
    rep(i,n){
        if(ac[i]){
            answ += wa[i];
        }
    }

    cout << ansa << " " << answ << endl;
}

Measured memory_bytes: 4028
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let n = read::<i64>();
    if n == 1 {
        println!("Hello World");
        return;
    } else {
        let a = read::<i64>();
        let b = read::<i64>();
        println!("{}",a+b);
        return;
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define N 1000006
#define LL long long 
#define reg register
#define mod 1000000007
using namespace std;

LL n,m;
LL f[N],dp[N];

inline int qr()
{
	int x=0,w=1;char a=0;
	while(a<'0'||a>'9'){if(a=='-')w=-1;a=getchar();}
	while(a<='9'&&a>='0'){x=(x<<3)+(x<<1)+(a^48);a=getchar();}
	return x*w;
}

inline LL qrl()
{
	LL x=0,w=1;char a=0;
	while(a<'0'||a>'9'){if(a=='-')w=-1;a=getchar();}
	while(a<='9'&&a>='0'){x=(x<<3)+(x<<1)+(a^48);a=getchar();}
	return x*w;
}


LL Pow(LL a, LL b)
{
	LL ans = 1, base = a;
	while(b>0)
    {
		if(b&1)
			ans*=base;
		ans%=mod; 
        base *= base;
        base%=mod;
		b >>= 1;
	}
	return ans%mod;
}

//LL gui(int x)
//{
//	if(x==2)
//		return 2;
//	if(x==1)
//		return 0;
//	LL k=(mul[x]/(mul[x-2]*mul[2])*2)%mod;
//	return (k*Pow(10,x-2)%mod-gui(x-2))%mod;
//}

int main()
{
	n=qrl();
	cout<<((Pow((long long)10,n)%mod-(long long)2*Pow((long long)9,n)%mod+Pow((long long)8,n)%mod)+mod)%mod;
	return 0;
}

Measured memory_bytes: 3564
#include <math.h>
#include <stdio.h>
int dis(int x1, int y1, int x2, int y2) { return abs(x1 - x2) + abs(y1 - y2); }
int main() {
	int n, m, a[50], b[50], c[50], d[50], ans, min, distance;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &a[i], &b[i]);
	}
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &c[i], &d[i]);
	}
	for (int i = 0; i < n; i++) {
		min = 1e9;
		for (int j = 0; j < m; j++) {
			distance = dis(a[i], b[i], c[j], d[j]);
			if (min > distance) {
				min = distance;
				ans = j + 1;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <iostream>
using namespace std;
int main(){
	int A, B;
	cin >> A >> B;
	if(A != 1 && B != 1){
		if(A > B){
			cout << "Alice" << endl;
		}else if(A < B){
			cout << "Bob" << endl;
		}else{
			cout << "Draw" << endl;
		}
	}else{
		if(A == 1 && B != 1){
			cout << "Alice" << endl;
		}else if(A != 1 && B == 1){
			cout << "Bob" << endl;
		}else if(A == 1 && B == 1){
			cout << "Draw" << endl;
		}
	}
}


Measured memory_bytes: 256
#                               #
    # author : samars_diary #
    # 17-09-2020 │ 16:08:30 #
#                               #

import sys, os.path, math

#if(os.path.exists('input.txt')):
    #sys.stdin = open('input.txt',"r")
    #sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

def mod(): return 10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))

#print=sys.stdout.write

def solve():
    n,d=mii();c=0
    for _ in range(n):
        a,b=mii()
        if math.sqrt((a**2)+(b**2))<=d:
            c+=1
    print(c)
for _ in range(1):
    solve()

Measured memory_bytes: 9144
#include<stdio.h>
#include<string.h>
int map[100][100];
int main(){
	int n,m,i,a,b,j,sum;
	scanf("%d%d",&n,&m);
	memset(map,0,sizeof(map));
	for(i=0;i<m;i++){
		scanf("%d%d",&a,&b);
		map[a][b]++;
		map[b][a]++;
	}
	for(i=1;i<=n;i++){
		sum=0;
		for(j=1;j<=n;j++){
			sum+=map[i][j];
		}printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 256
// F.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <numeric>


using lolo=long long;
using namespace std;
using vec=vector<lolo>;
using pari=pair<lolo, lolo>;
using vvec=vector<vec>;
using vecb=vector<bool>;
#define FOR(i,n) for (lolo i=0; i<n; ++i)
#define FORIT(it,v) for (auto it=v.begin(); it!=v.end(); ++it)
#define FORANGE(it, v) for (auto it : v)
#define FORN(i,a,b) for (lolo i=a; i<b; ++i)
#define REV(i,a,b) for (lolo i=a; i>b; --i)
#define ALL(x) x.begin(), x.end()


template <class T>
void chmax(T& ans, const T& b)
{
	if (ans < b) {
		ans = b;
	}
}

int main()
{
	lolo N;
	cin >> N;
	vec S(N);
	FOR(i, N) cin >> S[i];
	// N-1の約数の個数?

	lolo ans = 0;

	FORN(C,1, N) {
		set<lolo> usedIndexSet;
		lolo nowScore = 0;
		lolo score = 0;
		lolo nowA = N - 1;
		const auto k_MAX = N ;
		FORN(k, 1, k_MAX+1) { 
			auto A2 = nowA - C;
			auto B = A2 - C;
			
			if (B > 0); else break;
			if (A2 != k * C); else break;			

			if (!((usedIndexSet.count(k * C) == 0) and (usedIndexSet.count(A2 ) == 0))) {
				break;
			}

			usedIndexSet.insert(k * C);//kCとA2が追加される。
			usedIndexSet.insert(A2);
			score += S[k * C];
			score += S[A2];
			chmax(ans, score);

			nowA =A2;

		}
	}
	cout << ans << endl;
	
}

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

int main(){
	string s;
	cin >> s;
	
	bool res = true;
	rep(i, s.size()/2){
		if(s.at(i) != s.at(s.size()/2-i-1)) res = false;
	}

	for(int i = (s.size()+3)/2-1; i < s.size(); i++){
		if(s.at(i) != s.at(s.size()-1-i)) res = false;
	}

	if(res) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
# 連結成分
# UF tree

N,M = map(int,input().split())
n_component = N

root = list(range(N+1))
depth = [0] * (N+1)

def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z

def merge(x,y):
  global n_component
  xx = find_root(x)
  yy = find_root(y)
  if xx == yy:
    return
  n_component -= 1
  if depth[xx] >= depth[yy]:
    root[yy] = xx
    depth[xx] += 1
  else:
    root[xx] = yy
    depth[yy] += 1
  
for _ in range(M):
  x,y,z = [int(x) for x in input().split()]
  merge(x,y)

answer = n_component
print(answer)


Measured memory_bytes: 67416
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
//const long long mod = 1000000007;
const long long mod = 998244353;

int search(int **c, int m) {
	if (c[0][m] == 1)return m;
	for (int i = 0; i < 20; i++) {
		if (m&(1 << i) && c[i][(m >> i) - 1]) {
			int r = (m >> i) - 1;
			for (int j = i - 1; j >= 0; j--) {
				r <<= 1;
				if (c[j][r | 1]) {
					r |= 1;
				}
			}
			return r;
		}
	}
	return -1;
}

int main() {
	int N, M;
	scanf("%d %d", &N, &M);
	int *A = new int[N];
	int *B = new int[N];
	std::pair<int, int> *p = new std::pair<int, int>[N];
	for (int i = 0; i < N; i++) {
		scanf("%d %d", A + i, B + i);
		p[i].first = -B[i];
		p[i].second = A[i];
	}
	std::sort(p, p + N);
	int **c = new int*[20];
	for (int i = 0; i < 20; i++) {
		c[i] = new int[(M >> i) + 1];
		if (i == 0) {
			for (int j = 0; j <= M; j++) {
				c[0][j] = 1;
			}
		}
		else {
			for (int j = 0; j <= M >> i; j++) {
				c[i][j] = c[i - 1][(j << 1)] + c[i - 1][(j << 1) + 1];
			}
		}
	}

	int res = 0;
	for (int i = 0; i < N; i++) {
		if (p[i].second <= M) {
			int r = search(c,M- p[i].second);
			if (r != -1) {
				res -= p[i].first;
				for (int l = 0; l < 20; l++) {
					c[l][r >> l]--;
				}
			}
		}
	}
	printf("%d", res);
	return 0;
}

Measured memory_bytes: 2560
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	ll x, y; cin >> x >> y;
	ll ans = 0;
	while (x <= y) {
		++ans;
		x *= 2LL;
	}
	cout << ans << "\n";

	return 0;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  while (b <= a) {
    b *= 2;
    --k;
  }
  while (c <= b) {
    c *= 2;
    --k;
  }
  cout << (k < 0 ? "No\n" : "Yes\n");
}


Measured memory_bytes: 3652
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    string s;
    cin>>s;
    if(s[0]=='C')
        cout<<"Rainy"<<endl;
    else if(s[0]=='R')
        cout<<"Sunny"<<endl;
    else
        cout<<"Cloudy"<<endl;




}
//Alhamdulillah
























Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k%2==0){
    cout<<a-b;
  }
  else{
    cout<<b-a;
  }
  return(0);
}


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

int main() {
  int n;
  cin >> n;
  int data[n] = {};
  for (int i = 0; i < n; i++) {
     cin >> data[i];
   }
  int vec[n];
  vec[0] = data[0];
  for (int i = 1; i < n; i++) {
    vec[i] = data[vec[i - 1] - 1];
  }
    
  int c = -1;
  for (int i = 0; i < n; i++) {
  if (vec[i] == 2) {
    c = i + 1;
    break;
  }
}
cout << c << endl;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;
long long n,m,a[105][100005],f[105][100005];
int main() {
    cin >> n >> m;
    for (long i=1; i<=n; i++) {
        for (long j=1; j<=2; j++) cin >> a[i][j];
    }
    for (long i=1; i<=n; i++) {
        for (long j=1; j<=m; j++) {
            if (a[i][1] <= j) {
                f[i][j] = max(f[i-1][j], a[i][2] + f[i-1][j-a[i][1]]);
            } else {
                f[i][j] = f[i-1][j];
            }
        }
    }
    cout << f[n][m];
    return 0;
}


Measured memory_bytes: 159232
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

string solve(string &S, string &T){
    int cnt1 = 0, cnt2 = 0;
    for(int i=0; i<S.size(); i++){
        if(S[i] == 'A') cnt1++;
        else cnt1 += 2;
    }
    for(int i=0; i<T.size(); i++){
        if(T[i] == 'A') cnt2++;
        else cnt2 += 2;
    }
    if(cnt1 % 3 == cnt2 % 3) return "YES";
    else return "NO";
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    int q;
    cin >> S >> T >> q;
    vector<int> cntS(S.size()+1, 0);
    vector<int> cntT(T.size()+1, 0);

    for(int i=1; i<=S.size(); i++){
        if(S[i-1]=='A') cntS[i] = cntS[i-1] + 1;
        else cntS[i] = cntS[i-1] + 2;
    }
    for(int i=1; i<=T.size(); i++){
        if(T[i-1]=='A') cntT[i] = cntT[i-1] + 1;
        else cntT[i] = cntT[i-1] + 2;
    }

    for(int i=0; i<q; i++){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        int tmp1 = cntS[b] - cntS[a-1];
        int tmp2 = cntT[d] - cntT[c-1];
        if(tmp1 % 3 == tmp2 % 3) cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}


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

    string s="";
    getline(cin,s);
    int x=s.length();
        for(int i=0;i<x;i++){
            if(s[i]==','){
            s[i]=' ';
            }
        }
      cout<<s;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,k,a[100005];
int main()
{
    cin>>n>>k;
    for(int I=1;I<=k;++I)
    {
        int nf;cin>>nf;
        for(int i=1;i<=nf;++i)
        {
            int x;cin>>x;
            a[x]=1;
        }
    }
    int r=0;
    for(int i=1;i<=n;++i) if(!a[i]) r++;
    cout<<r;

}


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

#undef int
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
#define int long long int
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int t = 1;
	//cin >> t;
	while (t--) {
		int n;
		cin >> n;
		int arr[n];
		int x = 0;
		for (int i = 0; i < n; i++) {
			cin >> arr[i];
			x = x ^ arr[i];
		}
		for (int i = 0; i < n; i++)
			cout << (arr[i]^x) << " ";
	}
	return 0;
}

Measured memory_bytes: 5204