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

typedef long long ll;

int a, b;
bool ok;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> a >> b;
    unordered_set<int> s1 = {1,3,5,7,8,10,12};
    unordered_set<int> s2 = {4,6,9,11};
    unordered_set<int> s3 = {2};
    if (s1.count(a) && s1.count(b))
        ok = true;
    if (s2.count(a) && s2.count(b))
        ok = true;
    if (s3.count(a) && s3.count(b))
        ok = true;
    if (ok)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 3596
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int a[10][10];

int main(int argc, char* argv[])
{
    int n,d;
    scanf("%d%d", &n, &d);

    int i,j;
    for(i=0; i<n; i++) {
        for(j=0; j<d; j++) {
            scanf("%d", &a[i][j]);
        }
    }
    const double eps=1e-12;
    int cnt=0;
    for(i=0; i<n; i++) {
        for(j=i+1; j<n; j++) {
            int sum=0;
            int k;
            for(k=0; k<d; k++) {
                sum+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
            }
            double tmp=sqrt((double)sum);
            if(fabs(tmp-float(tmp))<eps) cnt++;
        }
    }
    printf("%d\n", cnt);

    return 0;
}


Measured memory_bytes: 128
function Main (input) {
  input = input.split("\n")[0].split(" ").map(Number);
  var A = input[0];
  var B = input[1];
  var K = input[2];
  A -= K;
  if (A < 0) {
    B -= Math.abs(A);
    A = 0;
  }
  if (B < 0) {
    B = 0;
  }
  console.log("%d %d", A, B);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include "bits/stdc++.h"

using namespace std;

int main(void){
  int dice[7], dice1[7];
  for(int i = 1;i < 7;++i){
    scanf("%d", dice + i);
  }
  for(int i = 1;i < 7;++i){
    scanf("%d", dice1 + i);
  }

  string commands = "EEENEEENEEESEEESEEENEEEN";
  int tmp;
  bool flag = false;
  for(int i = 0;i < commands.length();++i){
    bool t = true;
    for(int j = 1;j < 7;++j){
      if(dice[j] != dice1[j]){
        t = false;
      }
    }
    if(t){
      flag = true;
    }
    char command = commands[i];
    switch(command){
      case 'N':
        tmp = dice[1];
        dice[1] = dice[2];
        dice[2] = dice[6];
        dice[6] = dice[5];
        dice[5] = tmp;
        break;
      case 'E':
        tmp = dice[3];
        dice[3] = dice[1];
        dice[1] = dice[4];
        dice[4] = dice[6];
        dice[6] = tmp;
        break;
      case 'W':
        tmp = dice[4];
        dice[4] = dice[1];
        dice[1] = dice[3];
        dice[3] = dice[6];
        dice[6] = tmp;
        break;
      case 'S':
        tmp = dice[6];
        dice[6] = dice[2];
        dice[2] = dice[1];
        dice[1] = dice[5];
        dice[5] = tmp;
        break;
    }
  }

  printf(flag ? "Yes\n" : "No\n");

  return 0;
}



Measured memory_bytes: 3356
import sys

sys.setrecursionlimit(10**5+100)
n = int(input())

edges = [[] for _ in xrange(n)]
distance = [-1 for _ in xrange(n)]

for _ in xrange(n-1):
	f,t,c = map(int,raw_input().split())

	f -= 1
	t -= 1

	edges[f].append((t,c))
	edges[t].append((f,c))

q,k = map(int,raw_input().split())
k -= 1

def dfs(v,c):
	if distance[v] == -1:
		distance[v] = c
		for to,cost in edges[v]:
			dfs(to,c+cost)

dfs(k,0)

for _ in xrange(q):
	x,y = map(int,raw_input().split())
	x -= 1
	y -= 1
	print distance[x] + distance[y]


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

using namespace std;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()
#define INF (int)1e9
#define MOD 1000000007
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
int a[mxN];

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

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

    vi v(n);
    for (auto &x : v)
        cin >> x;
    sort(v.begin(), v.end());
    int s = 0;
    for (int i = 0; i < k; ++i)
        s += v[i];
    cout << s;

    return 0;
}

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

#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))


using namespace std;


typedef long long LL;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef pair<int,vi> iv;
typedef pair<LL,LL> pLL; 


int main(){
	int N,ans = 0;
	cin>>N;
	vi A(N);
	for(int i=0;i<N;++i) cin>>A[i];
	sort(A.begin(),A.end());
	queue<int> que;
	for(auto k:A){
		while(!que.empty() && que.front()<k-2) que.pop();
		que.push(k);
		ans = max(ans,(int)que.size());
	}
	cout<<ans<<endl;
	return 0; 
}

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

//typedef
//------------------------------------------
typedef int64_t LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rwhole(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)
#define EACH(i,c) for(decltype((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) whole(sort, c)
#define RSORT(c) rwhole(sort, c)

//constant
//--------------------------------------------
constexpr double EPS = 1e-10;
constexpr double PI  = M_PI;
constexpr int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

template<class T,class U> void chmax(T&a,U b){if(a<b)a=b;}
template<class T,class U> void chmin(T&a,U b){if(b<a)a=b;}
LL gcd(LL a, LL b) { return b?gcd(b,a%b):a;}
LL lcm(LL a, LL b) { return a/gcd(a,b)*b;}

//main code

int main(int argc, char *argv[])
{
	int n;cin >> n;
	cout << (n*(n+1))/2 << endl;
	return 0;
}


Measured memory_bytes: 256
def ispalindrome(S,N):
    for a, b in zip(S[:N], reversed(S[:N])):
        if a != b: return 0
    return 1

def ispalindrome2(S,N):
    for a, b in zip(S[N2-1:N], reversed(S[N2-1:N])):
        if a != b: return 0
    return 1

S = input()
N = len(S)
N1 = (N-1)//2
N2 = (N+3)//2

r1 = ispalindrome(S,N)
r2 = ispalindrome(S,N1)
r3 = ispalindrome2(S,N2)
if r1==1 and r2==1 and r3==1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
struct Node{
  int no;
  int par;
  int num;
  void build(int i){
    no=i;
    par=i;
    num=inf;
  }
  vector<Node*> child;
};
signed main(){
  int n;cin>>n;
  vector<Node> node(n+1);
  rep1(i,n){
    node[i].build(i);
  }
  rep(i,n-1){
    int a,b;cin>>a>>b;
    node[a].child.push_back(&node[b]);
    node[b].child.push_back(&node[a]);
  }
  vector<int> c(n);
  rep(i,n)cin>>c[i];
  sort(c.begin(),c.end());
  queue<Node> que;
  node[1].num=c[n-1];
  que.push(node[1]);
  int cur=n-2;
  while(!que.empty()){
    Node buf=que.front();
    que.pop();
    int k=buf.child.size();
    rep(i,k){
      if(buf.par!=buf.child[i]->no){
        buf.child[i]->par=buf.no;
        buf.child[i]->num=c[cur];
        cur--;
        que.push(*buf.child[i]);
      }
    }
  }
  int sum=0;
  rep(i,n-1){
    sum+=c[i];
  }
  cout<<sum<<"\n";
  rep1(i,n){
    printf("%lld ",node[i].num);
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 2176
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;;
#define ato find_by_order
#define of order_of_key
typedef long long ll;
#define pb push_back
#define flash ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
ll val[100005];ll ans[100005];vector<ll> graph[100005];
ll vis[100005]; ll weight[100005];
void dfs(ll curr,ll c,ll kabad) {
    
    vis[curr]=1;
    if(val[curr]==1){
        c++;
        kabad=max(kabad,c);
        ans[curr]=kabad;
    }
    else {
        c=0;
        ans[curr]=kabad;
    }
    for(auto x:graph[curr]) {
        ll child=x;
        if(vis[child]==0){
            
            dfs(child,c,kabad);
        }
    }
}
ll mul(ll a,ll b,ll m){
    ll res=((a%m)*(b%m))%m;
    return res;
}

int main(){
    ll t;
    t=1;
    while(t--) {
        ll n;
        cin >> n;
        ll a[n+1]={0};
        ll suff[n+1]={0};
        for(ll i=1;i<=n;i++){
            cin >> a[i];
        }
        suff[n]=a[n];
        for(ll i=n-1;i>=2;i--){
            suff[i]=a[i]+suff[i+1];
        }
        ll ans=0,m=1e9+7;
        for(ll i=1;i<n;i++){
            ans+=(mul(a[i],suff[i+1],m));
            ans=ans%m;
        }
        ans=ans%m;
        cout<<ans<<endl;
        
        
        
    }
}


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

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

int main() {
    int n, cnt = 0, ans = 0;
    int a, b, k;
    cin >> k >> a >> b;
    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3572
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;
using ll = long long;
using ld = long double;
const ll mod =  998244353;
const ll inf = 1e18;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (ll i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename T> void print_vec(vector<T> a) {int n = a.size();REP(i, n) {cout >> a[i]; if(i!=n-1) cout << " "; else cout << endl;}}
ll power(ll base, ll exponent){ if(exponent % 2){ return power(base, exponent - 1) * base % mod; }else if(exponent){ ll root_ans = power(base, exponent / 2); return root_ans * root_ans % mod; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
template<typename T> ll sum(T begin, T end) {return accumulate(begin, end, 0ll);}
struct combination{ vector<ll> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } ll C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int bsearch(const vector<ll>& a, ll x){
  int lft = 0;
  int rgt = a.size();
  while (rgt - lft > 1) {
    int mid = (lft + rgt) / 2;
    if(a[mid] < x) {
      lft = mid;
    }
    else {
      rgt = mid;
    }
  }
  return lft;
}

struct UnionFind {
  vector<int> par;

  UnionFind(int n) : par(n, -1) {}
  void init(int n) { par.assign(n, -1); }

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

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return;
    if (par[x] > par[y])
      swap(x, y);
    par[x] += par[y];
    par[y] = x;
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { return -par[root(x)]; }
};

vector<ll> v;
vector<int> used;
vector<vector<ll>> to;

void dfs(int c, ll cum) {
  if(used[c]) return;
  used[c] = true;
  ll cv = v[c];
  v[c] += cum;
  for(auto next : to[c]) {
    dfs(next, cum + cv);
  }
}
signed main() {
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  v.resize(n);
  to.resize(n);
  used.resize(n, false);
  REP(i, n-1) {
    ll a, b;
    cin >> a >> b;
    a--;b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  REP(i, q) {
    ll p, x;
    cin >> p >> x;
    p--;
    v[p] += x;
  }
  dfs(0, 0);
  REP(i, n) {
    cout << v[i] << " ";
  }
  cout << endl;
  return 0; 
}


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



int main() {
    
    vector<vector<vector<int>>> heya(4,vector<vector<int>> (3,vector<int>(10,0)));
    
    int n;
    cin>>n;
    rep(i,n){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        heya[a-1][b-1][c-1]+=d;
    }
    for(int i=0; i<4; i++){
        for(int j=0; j<3; j++){
            for(int k=0; k<10; k++){
                cout<<" "<<heya[i][j][k];
            }
            cout<<endl;
        }
        if(i!=3) cout<<"####################"<<endl;
    }
  
}


Measured memory_bytes: 3152
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		
		out.close();
	}
	
	static class TaskB
	{
		void solve(int TestCase, InputReader in, PrintWriter out)
		{
			int a = in.nextInt();
			int b = in.nextInt();
			int ans = 0;
			int tmp = 0;
			
			if(b == 1)
			{
				out.println("0");
			}
			else
			{
				for(int i = 1; i <= 20; i++)
				{
					if(a * i - tmp >= b)
					{
						out.println(i);
						return;
					}
					tmp++;
				}
			}
		}
	}
	
	static class InputReader
	{
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		
		public InputReader(InputStream stream)
		{
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		
		public String next()
		{
			while(tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					tokenizer = new StringTokenizer(reader.readLine());
				}
				catch(IOException e)
				{
					throw new RuntimeException(e);
				}
			}
			
			return tokenizer.nextToken();
		}
		
		public int nextInt()
		{
			return Integer.parseInt(next());
		}
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    
    ll res = 0;
    for(int i = 0; i < N; i++){
        if(a[i] % 2 == 0){
            while(a[i] % 2 == 0){
                a[i] /= 2;
                res++;
            }
        }
    }
    
    cout << res << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
long long sum = 0;

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

bool visited[8] = {false};
double sums = 0;
int f = 1;
int x[8], y[8];
double range(int i, int j){
    return sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
}

void bfs(int i, double sum){
    visited[i] = true;
    rep(j, N){
        if(!visited[j]) bfs(j, sum+range(i, j)); 
    }
    bool flag = false;
    rep(j, N){
        flag |= !visited[j];
    }
    if(!flag) sums += sum/f;
    visited[i] = false;
}

int main() {
    cin >> N;
    rep(i, N){
        cin >> x[i] >> y[i];
    }
    rep(i, N){
        f *= (i+1);
    }
    rep(i, N){
        bfs(i, 0);
    }
    cout << setprecision(16) <<sums;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {

	public static void main(String[] args) throws IOException {
		ContestScanner scan = new ContestScanner();

		final int N = scan.nextInt();
		final int L = scan.nextInt();

		String[] S = new String[N];

		for(int i=0; i < N; i++) S[i] = scan.next();

		(new Solve(N, L, S)).solve();
	}
}

class Solve {
	private final int N;
	private final int L;

	private final String[] S;

	public Solve(final int N, final int L, final String[] S)
	{
		this.N = N;
		this.L = L;
		this.S = S;
	}

	public void solve()
	{
		String[] S = (String[])this.S.clone();

		Arrays.sort(S);

		StringBuilder sb = new StringBuilder();

		for(int i=0; i < N; i++) sb.append(S[i]);

		System.out.println(sb.toString());
	}
}
class ContestScanner {
	BufferedReader reader;
	String[] line;
	int index;
	public ContestScanner() {
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException {
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}

	public String nextToken() throws IOException {
		if(line == null || index >= line.length)
		{
			line = reader.readLine().trim().split(" ");
			index = 0;
		}

		return line[index++];
	}

	public String next() throws IOException {
		return nextToken();
	}

	public String readLine() throws IOException {
		line = null;
		index = 0;

		return reader.readLine();
	}

	public int nextInt() throws IOException, NumberFormatException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException, NumberFormatException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException, NumberFormatException {
		return Double.parseDouble(nextToken());
	}

	public int[] nextIntArray(int N) throws IOException, NumberFormatException {
		int[] result = new int[N];

		for(int i=0; i < N; i++) result[i] = nextInt();

		return result;
	}

	public long[] nextLongArray(int N) throws IOException, NumberFormatException {
		long[] result = new long[N];

		for(int i=0; i < N; i++) result[i] = nextLong();

		return result;
	}

	public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
		double[] result = new double[N];

		for(int i=0; i < N; i++) result[i] = nextDouble();

		return result;
	}
}


Measured memory_bytes: 8272
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <cstring>
#include <deque>
#include <set>
#include <sstream>
#include <map>
#include <iomanip>
using namespace std;

long long p[26];

int main()
{
	long long ans = 1;
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++)
		p[s[i] - 'a']++;
	for (int i = 0; i < 26; i++)
		for (int j = i + 1; j < 26; j++)
			ans += p[i] * p[j];
	cout << ans;
}

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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("test/sample-1.in");

    int N;
    cin >> N;
    vector<int> B(N-1);
    for (int i=0; i<N-1; ++i) cin >> B[i];

    int sum = B[0] + B[N-2];
    for (int i=0; i<N-2; ++i) {
        sum += min(B[i], B[i+1]);
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
 
using namespace std;
 
int d[4]={10,13,16,19}, dd[2]={1,22};
int x[4][5]={ {7,8,9,10,13},
          {1,2,3,15,19},
          {1,4,7,10,16},
          {3,6,9,12,13} };
int y[4][5]={ {22,23,24,12,18},
          {28,29,30,16,21},
          {24,27,30,21,18},
          {22,25,28,19,15} };
 
int is_puzzle(vector<int> a)
{
  for(int i=0;i<4;i++){
    int e = d[i];
    if(a[e] != a[e+1] || a[e] != a[e+2] || a[e+1] != a[e+2])
      return 0;
  }
  for(int i=0;i<2;i++)
    for(int j=dd[i];j<dd[i]+9;j++)
      if(a[dd[i]] != a[j])
    return 0;
  return 1;
}
 
vector<int> mawasu(vector<int> a, int idx)
{
  for(int i=0;i<5;i++)
    swap(a[x[idx][i]], a[y[idx][i]]);
  return a;
}
 
int bfs(vector<int> a)
{
  queue<pair<vector<int>, int> >q;
  q.push(make_pair(a, 0));
 
  while(!q.empty()){
    vector<int>cur = q.front().first;
    int ret = q.front().second;
    q.pop();
    if(is_puzzle(cur))
      return ret;
 
    for(int i=0;i<4;i++){
      vector<int>tar = mawasu(cur, i);
      q.push(make_pair(tar, ret+1));
    }
  }
  return 0;
}
 
int main()
{
  vector<int>p(32);
  int n;
  scanf("%d", &n);
  while(n--){
    p[0] = p[31] = 0;
    for(int i=1;i<=30;i++)
      scanf("%d", &p[i]);
 
    printf("%d\n", bfs(p));
  }
  return 0;
}


Measured memory_bytes: 17268
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;

const ll MOD = 2019;

ll mod(ll x){
	x %= MOD;
	return x;
}

ll min(ll x,ll y){
	if(x<y) return x;
	return y;
}

int main()
{
	ll l,r;
	cin>>l>>r;

	int mn = 2018;

	for(ll i=0; i<=2019 and (i+l) < r; i++){
		for(ll j=0;(r+j) > l and j>=-2019;j--){
			ll x = (l+i)%MOD;
			ll y = (r+j)%MOD;
			mn = min(mn,mod(x*y));

		}
	}

	cout<<mn<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#ifndef ONLINE_JUDGE
//#  define LOG(x) (cerr << #x << " = " << (x) << endl)
//#else
//#  define LOG(x) 0
//#endif
#define pb push_back
#define mod 1000000007
#define endl '\n'
typedef int integer;
#define int long long
using namespace std;

int powmod(int a, int b) {
    int res = 1;
    a %= mod;
    assert(b >= 0);
    for (; b; b >>= 1) {
        if (b & 1)res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}

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

const integer NN = 200005;
int ar[NN];
int n, m, k;
vector<int> adj[NN];


integer main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    for (int i = 0; ; i++){
        for (int j = 0; j <= i; j++){
            int a = pow(i, 5);
            int b = pow(j, 5);
            if (a + b == n){
                cout << i << ' ' << -j;
                return 0;
            }
            if (a - b == n){
                cout << i << ' ' << j;
                return 0;
            }
        }
    }

}


Measured memory_bytes: 8804
#include <bits/stdc++.h>
using namespace std;
int effort(int q,vector<int> &adress,int &N){
int a=0;
  for(int i=0;i<N;i++){
  a+=(q-adress.at(i))*(q-adress.at(i));
  }
  return a;                     
}
int main(){
  int N;
  cin>>N;
  vector<int> adress(N);
  for(int i=0;i<N;i++){
  cin>>adress.at(i);
  }
  int ans=1000000000;
  for(int i=0;i<100;i++){  
  if(effort(i,adress,N)<ans){
  ans=effort(i,adress,N);
  }
}  
  cout<<ans<<endl;
}

Measured memory_bytes: 3580
x_1, y_1, x_2, y_2 = [int(xy) for xy in input().split()]
dx = x_2 - x_1
dy = y_2 - y_1

x_3 = x_2 - dy
y_3 = y_2 + dx
x_4 = x_1 - dy
y_4 = y_1 + dx

print(str(x_3) + " " + str(y_3) + " " + str(x_4) + " " + str(y_4))

Measured memory_bytes: 3060
# coding: utf-8

NULL = -1

class Node():
    def __init__(self):
        self.parent =  NULL # parent node
        self.left = NULL    # first child node
        self.right = NULL   # brother node
        self.depth = NULL   # depth of node
        self.type = ""      # type of node(root, internal node, leaf)

def set_depth(T: list, r: int, d: int):
    T[r].depth = d
    if T[r].left != NULL:
        set_depth(T, T[r].left, d + 1)

    if T[r].right != NULL:
        set_depth(T, T[r].right, d)

n = int(input())

T = []
for i in range(n):
    T.append(Node())

cur = 0
for i in range(n):
    nodeinfo = [int(x) for x in input().split()]
    for j in range(nodeinfo[1]):
        if j == 0:
            T[nodeinfo[0]].left = nodeinfo[2+j]
        else:
            T[cur].right = nodeinfo[2+j]
        cur = nodeinfo[2+j]
        T[cur].parent = nodeinfo[0]

# find root node
root = 0
for i, v in enumerate(T):
    if v.parent == NULL:
        root = i
        break

# set depth to all nodes
# set_depth(T, root, 0)

# set type
for v in T:
    if v.parent == NULL:
        v.type = "root"
    elif v.left == NULL:
        v.type = "leaf"
    else:
        v.type = "internal node"

for i, v in enumerate(T):
    childlen = []
    if T[i].left != NULL:
        child = T[i].left
        childlen.append(str(child))

        while T[child].right != NULL:
            child = T[child].right
            childlen.append(str(child))

    depth = 0
    cur = i
    while T[cur].parent != NULL:
        depth += 1
        cur = T[cur].parent
            
    print("node {}: parent = {}, depth = {}, {}, {}".format(i, v.parent, depth, v.type, "[" + ", ".join(childlen) + "]"))


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

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int t;
    t=a;
    a=b;
    b=t;
    t=a;
    a=c;
    c=t;
    printf("%d %d %d",a,b,c);
}


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

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

    vector<int> A(N), B(N), C(N);
    rep(i, N) cin >> A.at(i);
    rep(i, N) cin >> B.at(i);
    rep(i, N) cin >> C.at(i);

    // B固定で考える
    ll count = 0, BAcount = 0, BCcount = 0;
    sort(A.begin(), A.end());
    sort(C.begin(), C.end());
    vector<int>::iterator iter;
    //　N^2
    rep(i, N) {  // Bのループ
        iter = lower_bound(A.begin(), A.end(), B.at(i));
        ll indexA = iter - A.begin();
        BAcount = indexA;

        iter = upper_bound(C.begin(), C.end(), B.at(i));
        ll indexC = iter - C.begin();
        BCcount = N - indexC;

        count += BAcount * BCcount;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1408
import math
n, d = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(n)]
count = 0
def dist(X0, X1):
    l = 0
    for x0, x1 in zip(X0, X1):
        l += (x0 - x1) ** 2
    return math.sqrt(l)
for i in range(n - 1):
    for j in range(i + 1, n):
        l = dist(X[i], X[j])
        if l.is_integer():
            count += 1
print(count)

Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <assert.h>
#include <iomanip>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> v;
    for(int i = 0; i < M; i++) {
        int k;
        cin >> k;
        vector<int> tmp(k);
        for(int j = 0; j < k; j++) {
            cin >> tmp[j];
            tmp[j]--;
        }
        v.push_back(tmp);
    }
    vector<int> p(M);
    for(int i = 0; i < M; i++) cin >> p[i];

    ll ans = 0;
    for(int i = 0; i < (1 << N); i++) {
        int on = 0;
        for(int j = 0; j < M; j++) {
            int cnt = 0;
            for(auto e: v[j]) {
                if ((i >> e) & 1) cnt++;
            }
            if(cnt%2 == p[j]) on++;
        }
        if(on == M) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>

void Input_elements_column(int& n, int& m);
std::vector<std::vector<int>> Input_matrix(int n, int m);
std::vector<std::vector<int>> Add_row_column(std::vector<std::vector<int>>matrix_A, int n, int m);
void output(std::vector<std::vector<int>> vector_c);

int main()
{
	int n, m;
	Input_elements_column(n, m);
	std::vector<std::vector<int>> matrix_a = Input_matrix(n, m);

	std::vector <std::vector<int>> matrix = Add_row_column(matrix_a, n, m);

	output(matrix);

	return 0;
}

void Input_elements_column(int& n, int&m)
{
	std::cin >> n >> m;
}

std::vector<std::vector<int>> Input_matrix(int n, int m)
{
	std::vector<std::vector<int>> matrix_a(n, std::vector<int>(m));
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			std::cin >> matrix_a[i][j];
		}
	}
	return matrix_a;
}

std::vector<std::vector<int>> Add_row_column(std::vector<std::vector<int>>matrix_A, int n, int m)
{
	std::vector<std::vector<int>> matrix(n + 1, std::vector<int>(m + 1));

	for (int i = 0; i < n; ++i)
	{
		int sum_row = 0;
		for (int j = 0; j < m; ++j)
		{
			matrix[i][j] = matrix_A[i][j];
			matrix[n][j] += matrix[i][j];
			sum_row += matrix_A[i][j];
		}
		matrix[i][m] = sum_row;
	}
	matrix[n][m] = std::accumulate(matrix[n].begin(), matrix[n].end(), 0);
	return matrix;
}

void output(std::vector<std::vector<int>> vector_c)
{
	for (auto row : vector_c)
	{
		int roop = 0;
		for (auto element : row)
		{
			if (roop!=0)
			{
				std::cout << " ";
			}
			std::cout << element;
			roop++;
		}
		std::cout << std::endl;
	}
}




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

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

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

constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

class UnionFind {
    private :
        std::vector<int> par;
        std::vector<int> sz;
    public :
        UnionFind(int n) {
            par.resize(n);
            for (int i=0; i<n; i++) par[i] = i;
            sz.assign(n, 1);
        }
        void unite(int x, int y) {
            const int x_par = find(x);
            const int y_par = find(y);
            if (x_par == y_par) return;

            if (sz[x_par] < sz[y_par]) {
                par[x_par] = y_par;
                sz[y_par] += sz[x_par];
            } else {
                par[y_par] = x_par;
                sz[x_par] += sz[y_par];
            }
        }
        int find(int x) {
            if (par[x] == x) return x;
            else return par[x] = find(par[x]);
        }
        bool same(int x, int y) { return find(x) == find(y); }
        int size(int x) { return sz[find(x)]; }
};

void solve() {
    int N, M;
    cin >> N >> M;
    UnionFind uf(N);
    int ans = N-1;
    for (int i=0; i<M; ++i) {
        int a, b;
        cin >> a >> b;
        if (!uf.same(a-1, b-1)) {
            --ans;
            uf.unite(a-1, b-1);
        }
    }

    cout << ans << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3960
import sys
sys.setrecursionlimit(10 ** 8)

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    ans = 0
    for i in range(1, N+1):
        n = N//i
        ans += (1+n)*n*i//2
    print(ans)
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 63084
#include <iostream>
using namespace std;
string S;
int C[26] = {0};
int main(){
	cin >> S;
  	for(int i=0;i<S.size();i++){
		if(C[S[i]-'a']>=1){
          cout << "no" << endl;
          return 0;
        }else C[S[i]-'a']++;
    }
  	cout << "yes" << endl;
}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

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

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1e9;

int main(){
   int n;cin >> n;
   int ans = 0;
   rep(i,n){
      int l,r;
      cin >> l >> r;
      ans += r - (l - 1);
   }
   cout << ans << endl;
   return 0;
}

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

int main(){
  string s;
  bool flg=false;
  cin >> s;
  for(int i=0;i<3;i++){
    if(s.at(i)=='7'){
      flg=true;
    }
  }
  if(flg){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}
      

Measured memory_bytes: 3600
N = int(input())
A = list(map(int, input().split()))

res = True
maxvar = max(A)

x = 0
y = 0

for i in range(N):
    if A[i] == maxvar:
        x += 1
    elif A[i] == maxvar - 1:
        y += 1
    else:
        res = False
        break
else:
    if (maxvar - y) * 2 + y > N or y >= maxvar:
        res = False

    if maxvar == N - 1 and y == 0:
        res = True

print('Yes' if res else 'No')

Measured memory_bytes: 13964
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	let count = parseInt(input[0]);
  	var ac = 0;
    var wa = 0;
    var tle = 0;
    var re = 0;
  	for (let i = 1; i <= count; i++) {
      switch (input[i]){
        case 'AC':
          ac ++;
          break;
        case 'WA':
          wa ++;
          break;
        case 'TLE':
          tle ++;
          break;
        case 'RE':
          re ++;
          break;
      }
    }
    console.log('AC x ' + ac);
    console.log('WA x ' + wa);
    console.log('TLE x ' + tle);
    console.log('RE x ' + re);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 37380
N=input()
A=list(map(int, input().split()))
B=list(map(int, input().split()))

if sum(A) < sum(B) : 
    print(-1)
else :
    diff=[A[i] - B[i] for i in range(len(A))]
    pos=sorted([x for x in diff if x > 0])
    neg=[x for x in diff if x < 0]
    nes=sum(neg)
    if nes >= 0 :
        print(0)
    else:
        items = 0
        total_pos = 0
        for p in reversed(pos):
            items += 1
            total_pos += p
            if(total_pos + nes >= 0) :
                print(items + len(neg))
                break


Measured memory_bytes: 18356
let () =
  let s = read_line () in
  Array.init (String.length s) (fun i ->
    let k = max i (String.length s - i - 1) in
    if s.[i] = '0'
    then (max_int, k)
    else (k, max_int))
  |> Array.fold_left (fun (a, b) (c, d) -> (min a c, min b d)) (String.length s, String.length s)
  |> (fun (a, b) -> max a b)
  |> Printf.printf "%d\n"


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


double win_prob(int init, int goal) {
    int value = init;
    double prob = 1.0;
    while (value < goal) {
        prob *= 0.5;
        value *= 2;
    }
    return prob;
};

int main() {
    int N, K; cin >> N >> K;
    double ans = 0.0;
    for (int i = 1; i <= N; i++) {
        ans += win_prob(i, K);
    }

    ans /= (double) N;
    cout << setprecision(15) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
ll a[100005];
ll b[100005];
ll c[100005];
ll dp[100005][3];
ll n;
ll  rec(ll i,ll prev)
{
	if(i==n)
		return 0;
	ll &res=dp[i][prev];
	if(res!=-1)
		return res;
	res=INT_MIN;
	if(prev==0)
		res=max(rec(i+1,1)+b[i],rec(i+1,2)+c[i]);
	if(prev==1)
		res=max(rec(i+1,0)+a[i],rec(i+1,2)+c[i]);
	if(prev==2)
		res=max(rec(i+1,1)+b[i],rec(i+1,0)+a[i]);
	return res;
}


 
int main()
{
	cin>>n;

	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	memset(dp,-1,sizeof(dp));
	cout<<max(rec(1,0)+a[0],max(rec(1,1)+b[0],rec(1,2)+c[0]));
	
	
 
	return 0;
}

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

int main(){
  int N;
  int sum = 0;
  cin >> N;

  int num = N;
  while(num){
    sum += num % 10;
    num /= 10;
  }
  string result;
  if(N % sum == 0){
    result = "Yes";
  }else{
    result = "No";
  }
  cout << result << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
 
  double a,b,c,d,e,f;
  double X,Y;
  while(cin>>a>>b>>c>>d>>e>>f){
    Y=(c*d-f*a)/(b*d-e*a);
    X=(c-b*Y)/a;

    Y*=10000.0;
    if((int)Y%10>4)Y+=1.0;
    Y/=10000.0;
    X*=10000.0;
    if((int)X%10>4)X+=1.0;
    X/=10000.0;
    printf("%.3f %.3f\n",X,Y);
    
  }
  
}


Measured memory_bytes: 3212
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define MAX 10000000
#define SENTINEL 2e10;


int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int tmp = n * a;
    if(tmp < b) cout << tmp << endl;
    else cout << b << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
char s[100005];
int main(void){
	string str;
	int p = 0;
	for(int i = 0 ; i < 100 ; i ++){
		s[p ++] = '(';
	}
	int n , Min = 100;
	cin >> n;
	cin >> str;
	str.size();
	for(int i = 0 ; i < n ; i ++){
		if(str[i] == '(') s[p ++] = str[i];
		else p --;
		Min = min(Min , p);
	}
	for(int i = 0 ; i < 100 - Min ; i ++){
		cout << '(';
	}
	cout << str ;
	for(int i = Min ; i < p ; i ++){
		cout <<')';
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int n;
  cin >> n;
  vector<int> a(n);
  int x=0;
  for(int i = 0;i < n;i++){
      cin >> a[i];
      x ^= a[i];
  }
  for(int i = 0;i < n;i++){
    cout << to_string(a[i]^x) << " ";
  }
  cout << "\n";
  return 0;
}

Measured memory_bytes: 3936
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=(1ull<<63)-1,mod=1e18;
const int inf=(1ull<<31)-1;
int n,k,r,s,p,ans=0;
string a,a1;
map<char,char> mpc;
map<char,int> mpn;

int main()
{
	//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(15);
	cin>>n>>k>>r>>s>>p>>a;
	mpc['p']='s';
	mpc['r']='p';
	mpc['s']='r';
	mpn['p']=p;
	mpn['r']=r;
	mpn['s']=s;
	for (int i=0;i<n;i++){
		if (i>=k){
			if (a[i-k]==a[i]){
				if (a1[i-k]==mpc[a[i]]){
					a1.push_back(a[i]);
				}
				else {
					a1.push_back(mpc[a[i]]);
					ans+=mpn[a1[i]];
				}
			}
			else {
				a1.push_back(mpc[a[i]]);
				ans+=mpn[a1[i]];
			}
		}
		else {
			a1.push_back(mpc[a[i]]);
			ans+=mpn[a1[i]];
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int A, B, C;

int main(){
  cin.sync_with_stdio(false);
  cin >> A >> B >> C;

  if(C >= A && C <= B){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }




}

Measured memory_bytes: 256
n = gets.to_i
as = gets.split.map(&:to_i)

ans = 0
count = 0

n.times do |i|
  if as[i] < 0
    count += 1
    as[i] = as[i] * -1
  end
  ans += as[i]
end

ans -= (as.min * 2) if count % 2 != 0

puts ans


Measured memory_bytes: 8580
n=int(input())
a=list(map(int,input().split()))

mod = 10**9 + 7
res = 0
for i in range(60):
    cnt_one  = sum([a[j]&1 for j in range(n)]) #1とのandをとり，1の個数をカウント
    cnt_zero = n - cnt_one
    res += 2**i * cnt_one * cnt_zero
    a = [a[j]>>1 for j in range(n)] #各要素に対し，右に1ビットシフト
print(res % mod)

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

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int[] a = in.nextIntArray(n);
        int[] b = in.nextIntArray(n);
        int[] c = in.nextIntArray(n - 1);

        int ans = b[a[0] - 1];
        for (int i=1; i < n; i++) {
            if (a[i-1] == a[i] - 1) {
                ans += c[a[i-1] - 1];
                // out.println(i + ", Adding " + c[a[i-1] - 1]);
            }
            ans += b[a[i] - 1];
            // out.println(i + ", Adding " + b[a[i] - 1]);
        }

        out.println(ans);
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

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

}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define precise cout.precision(8); cout << fixed;
#define seed srand(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
using namespace std;

void solve() {
    int H, W, K, i, j, cnt = 0, ans = 0; cin >> H >> W >> K;
    vector<string> Graph(H);
    for(i = 0; i < H; i += 1) {
        cin >> Graph[i];
        for(j = 0; j < W; j += 1) {
            if(Graph[i][j] == '#') {
                cnt += 1;
            }
        }
    }
    for(i = 0; i < (1 << H); i += 1) {
        for(j = 0; j < (1 << W); j += 1) {
            vector<vector<bool> > done(H, vector<bool>(W, false));
            int temp = 0;
            for(int i1 = 0; i1 < H; i1 += 1) {
                if(((i >> i1) & 1) == 1) {
                    for(int j1 = 0; j1 < W; j1 += 1) {
                        if(done[i1][j1]) {
                            continue;
                        }
                        done[i1][j1] = true;
                        if(Graph[i1][j1] == '#') {
                            temp += 1;
                        }
                    }
                }
            }
            for(int j1 = 0; j1 < W; j1 += 1) {
                if(((j >> j1) & 1) == 1) {
                    for(int i1 = 0; i1 < H; i1 += 1) {
                        if(done[i1][j1]) {
                            continue;
                        }
                        done[i1][j1] = true;
                        if(Graph[i1][j1] == '#') {
                            temp += 1;
                        }
                    }
                }
            }
            if(cnt - temp == K) {
                ans += 1;
            }
        }
    }
    cout << ans;
}

int main() {
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3592
n=int(input())
b=[int(x) for x in input().split()]
a=[0]*n
for i in range(n-1):
	if(i==0):
		a[0]=b[0]
		a[1]=b[0]
	else:	
		if(b[i]>=b[i-1]):
			a[i+1]=b[i]
		if(b[i]<b[i-1]):		
			a[i]=b[i]
			a[i+1]=b[i]
print(sum(a))

Measured memory_bytes: 3064
# coding: utf-8
INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(input())


def ILI(): return list(map(int, input().split()))


def read():
    N = II()
    a = ILI()
    return (N, a)


def check_a(N, a):
    for _a in a:
        if _a >= N:
            return False
    return True


def solve(N, a):
    ans = 0
    while True:
        if check_a(N, a):
            break

        l_div, l_mod = [None] * N, [None] * N
        for i, _a in enumerate(a):
            l_div[i], l_mod[i] = divmod(_a, N)

        sum_div = sum(l_div)
        for i in range(N):
            a[i] = l_mod[i] + sum_div - l_div[i]

        ans += sum_div

    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
using namespace std;

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

    int m;
    if(n%(d*2+1) == 0){
        m = n/(d*2+1);
    }else{
        m = n/(d*2+1) + 1;
    }

    cout<<m<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  char s[200];
  cin >> s;
  int e=0,z;
  if(s[0]=='A'){
    for(int i=2;i<strlen(s)-1;i++){
      if(s[i]=='C'){
        e++;
        z=i;
      }
    }
    for(int i=1;i<strlen(s);i++){
      if(e==1&&z==i)continue;
      else if(s[i]>='A'&&s[i]<='Z')e=2;
    }
    if(e==1)cout << "AC";
    else cout << "WA";
  }
  else cout << "WA";
}


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

int main(){
  int a, b;
  cin >> a >> b;
  if (a >= 13){
    cout << b << endl;
  }else if(a >= 6 && a <= 12){
    cout << b/2 << endl;
  }else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256