akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> num(n);
    for(int i = 0; i < n; i++) {
        cin >> num.at(i);
    }
    int v,j;
    for(int i = 0; i < n; i++) {
        v = num.at(i);
        j = i - 1;
        while(j >= 0 && num.at(j) > v) {
            num.at(j+1) = num.at(j);
            j--;
        }
        num.at(j+1) = v;
        for(int k = 0; k < n; k++) {
            cout << num.at(k);
            if(k == n-1) cout << endl;
            else cout << " ";
        }
    }
}


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

using namespace std;

char M[100][100];
int val[100][100], vis[100][100];

int main()
{
    int H, W;

    scanf("%d%d", &H, &W);
    getchar();

    for (int i = 1; i <= H; i++) fgets(M[i] + 1, 100, stdin);

    memset(val, 0, sizeof (val));
    memset(vis, 0, sizeof (vis));

    for (int i = 1; i <= H; i++) for (int j = 1; j <= W; j++) if (M[i][j] == '#') val[i][j] = 1;

    for (int i = 1; i <= H; i++) for (int j = 2; j <= W; j++) if (M[i][j] == '#' && M[i][j - 1] == '#') vis[i][j] = vis[i][j - 1] = 1;
    for (int j = 1; j <= W; j++) for (int i = 2; i <= H; i++) if (M[i][j] == '#' && M[i - 1][j] == '#') vis[i][j] = vis[i - 1][j] = 1;

    bool ans = true;

    for (int i = 1; i <= H; i++) for (int j = 1; j <= W; j++) if (val[i][j] != vis[i][j]) ans = false;

    printf("%s\n", ans ? "Yes" : "No");

    return 0;
}


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

int main() {
    string S;
    cin >> S;
    int c=0;
    if (S[0]=='R' && S[1]=='R' && S[2]=='R') c=3;
    else if (S[0]=='R' && S[1]=='R' && S[2]=='S') c=2;
    else if (S[0]=='S' && S[1]=='R' && S[2]=='R') c=2;
    else if (S[0]=='R' && S[1]=='S' && S[2]=='S') c=1;
    else if (S[0]=='S' && S[1]=='R' && S[2]=='S') c=1;
    else if (S[0]=='S' && S[1]=='S' && S[2]=='R') c=1;
    else if (S[0]=='R' && S[1]=='S' && S[2]=='R') c=1;
    else if (S[0]=='S' && S[1]=='S' && S[2]=='S') c=0;
    cout << c << endl;
}

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

int main() {
    /*変数定義，入力*/
    int N, M;
    cin >> N >> M;

    int s;
    int c_temp;
    int c[N];
    bool isConf = false;
    rep(i, N){c[i] = -1;}

    rep(i, M){
        cin >> s;
        cin >> c_temp;
        if(c[s-1] != -1 && c[s-1] != c_temp){
            isConf = true;
        }else{
            c[s-1] = c_temp;
        }
    }

    if(isConf || (N != 1 && c[0] == 0)){
        cout << -1;
        return 0;
    }
    
    if(N != 1 && c[0] == -1){
        c[0] = 1;
    }

    rep(i, N){
        if(c[i] == -1){
            c[i] = 0;
        }
        cout << c[i];
    }
    /*終了*/
    return 0;
}

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


int main()
{
  int n;
  cin>>n;
  for(;n--;)
    {
      int y,m,d;
      cin>>y>>m>>d;
      int cnt=0;
      while(y<1000)
	{
	  d++;
	  cnt++;
	  if((y%3==0 && d>20)||
	     (y%3!=0 && m%2!=0 &&d>20) ||
	     (y%3!=0 && m%2==0 &&d>19) )
	    {
	      d=1;
	      m++;
	    }
	  if(m>10)
	    {
	      m=1;
	      y++;
	    }
	}
      cout<<cnt<<endl;
      
    }
}

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

int main() {
  int a,b;
  cin >> a >> b;
  int count = 0;
  int hole = 1;
  while(true){
    if(hole < b){
      hole += a-1;
      count++;
    }
    else
      break;
  }
  cout << count;
}


Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <string>

#define MAX_H 100

using namespace std;

string S[MAX_H];

int main() {
  int H, W;
  cin >> H >> W;
  printf("\n");
  for (int i = 0; i < H; ++i) {
    cin >> S[i];
  }
  for (int j = 0; j < W + 2; ++j) {
    printf("#");
  }
  printf("\n");
  for (int i = 0; i < H; ++i) {
    printf("#");
    printf("%s", S[i].c_str());
    printf("#\n");
  }
  for (int j = 0; j < W + 2; ++j) {
    printf("#");
  }
  printf("\n");
}

Measured memory_bytes: 3256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		List<Map<Integer, List<Integer>>> list = new ArrayList<>();
		int mapKey = 0;

		while (true) {
			Map<Integer, List<Integer>> combination = new HashMap<>();
			try {
				String[] condition = br.readLine().split("\\s");
				int n = Integer.parseInt(condition[0]);
				int x = Integer.parseInt(condition[1]);

				if (n == 0 && x == 0) {
					break;
				}
				
				for (int i = 1; i <= n - 2; i++) {
					for (int j = i + 1; j <= n - 1; j++) {
						for (int k = j + 1; k <= n; k++) {
							if ((x == (i + j + k))) {
								combination.put(mapKey, Arrays.asList(i, j, k));
								mapKey++;
							}
						}

					}

				}
				list.add(combination);

			} catch (NumberFormatException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			} catch (IOException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}

		}
		list.stream().forEach(map -> {
			System.out.println(map.size());
		});

	}

}



Measured memory_bytes: 32824
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

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

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

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

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x,a;
    cin>>x>>a;
    PUTS(x < a ? 0 : 10);
}

Measured memory_bytes: 256
/*
          Life before Death
          Strength before Weakness
          Journey before Destination
    */
    
    #include <bits/stdc++.h>
    using namespace std;
    
    typedef long long ll;
    #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define rep(i,a,n) for(ll i=a;i<n;i++)
    #define per(i,n,a) for (ll i=n;i>a;i--)
    #define te ll t; std::cin >> t; while(t--)
    #define SZ 100011
    //#define M_PI  3.141592653589793238462643383279502884L
    /*------Just DO IT--------------------------------------*/

    int solve(){
      ll n,x,y;
      cin >>n>>x>>y;
      ll a[n];
      rep(i,0,n) cin >>a[i];
      sort(a,a+n);
      ll acnt = 0, bcnt=0, ccnt = 0;
      rep(i,0,n){
        if(a[i] <= x) acnt++;
        if(a[i] >= x + 1 && a[i] <= y) bcnt++;
        if(a[i] >= y+1) ccnt++;
      }
      cout<<min(acnt,min(bcnt, ccnt))<<endl;
    } 
    
   int main() {
       fastio
       solve();
    }

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<LL> a(n);
    inc(i, 0, n) cin >> a[i];
    vector<LL> x(n, 0);
    inc(i, 0, n){
        if(i%2 == 0){
            x[0] += a[i];
        }else{
            x[0] -= a[i];
        }
    }
    inc(i, 1, n){
        x[i] = (a[i-1]-x[i-1]/2)*2;
    }

    inc(i, 0, n){
        cout << x[i];
        if(i != n-1){
            cout << " ";
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

vector<int> A(20);
vector<int> B(200);
int n,q,k;

bool dfs(int i, int sum){
    //最深部までチェック後
    if(i==n){
        return sum==k;  
    } 
    
    if(dfs(i+1,sum)==true){
        return true;
    }
    
    if(dfs(i+1,sum+A[i])==true){
        return true;
    }
    
    else return false;
}


int main(){
    scanf("%d",&n);
    for(int i=0; i<n; i++){
        int a;
        scanf("%d",&a);
        A[i]=a;
    }
    
    scanf("%d",&q);
    for(int i=0; i<q; i++){
        int b;
        scanf("%d",&b);
        B[i]=b;
    }
    
    
    for(int i=0; i<q; i++){
        k=B[i];
        if(dfs(0,0)==true) printf("yes\n");
        else printf("no\n");
    }
    
    return 0;
}


Measured memory_bytes: 3152
#include <stdio.h>

int main(void)
{
	int is_find[255][13] = {};
	int n;
	int i, j;

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		char str[16];
		char mark;
		int id;

		scanf(" %[^\n]", str);
		mark = *str;
		id = atoi(str + 2) - 1;

		is_find[mark][id] = 1;
	}
	for (i = 0; i < 4; i++){
		char mark = "SHCD"[i];
		for (j = 0; j < 13; j++){
			if (!is_find[mark][j]) printf("%c %d\n", mark, j + 1);
		}
	}
	return (0);
}

Measured memory_bytes: 616
#include<stdio.h>
int R=1,C=1,H[2000010],N[2000010];
//評価関数（いまはMIN）
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//取り出す関数
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int main(){
  int n,m,i,a;
  scanf("%d %d",&n,&m);
  while(n--){
    scanf("%d",&a);
    hin(a);
  }
  for(i=0;C-1;i++){
    a=N[hout()];
    if(m<a)break;
    m-=a;
    if(C==1&&m)i--;
  }
  //if(m&&C==1)i--;
  printf("%d\n",i);
  return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
//const int mod = 1000000007;
const int mod = 998244353;
 

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
 
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);
 
// M * (M-1)^(N-1-K) * N-1 C K
int main(int argc, const char * argv[]) {
    ll N,M,K; cin >> N >> M >> K;
    
    mint ans = 0;
    mint col = M;
    
    
    
    for(ll x=N-1; x>=0 ; x--){
        if(x<=K){
            ans += col * c(N-1,x);
        }
        col *= (M-1);
    }
    
    cout << ans << endl;
    
    
}



Measured memory_bytes: 6228
N, x = map(int, input().split())
a = sorted(list(map(int, input().split())))

count = 0
for i in range(N-1):
  if x>= a[i]:
    x = x - a[i]
    count += 1

if x == a[N-1]:
  count += 1
    
    
print(count)

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

const int N = 3001;
double ans[N][N];


int main()
{
	int n;
	cin >> n;
	double prob[N];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)
			ans[i][j] = 0;
	}
	for (int i = 1; i <= n; i++) {
		cin >> prob[i];
	}
	ans[1][0] = 1 - prob[1];
	ans[1][1] = prob[1];
	for (int i = 2; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			if (j <= i) {
				if (i > 1)
					ans[i][j] = ans[i-1][j] * (1 - prob[i]);
				if (j)
					ans[i][j] += ans[i-1][j-1] * (prob[i]);
			}
			else {
				ans[i][j] = 0;
			}
		}
	}
	double sol = 0;
	for (int i = ceil((double)n/2); i <= n; i++) {
		sol += ans[n][i];
	}
	cout << fixed << setprecision(12) << sol;
}






Measured memory_bytes: 70656
#include <iostream>
#include <algorithm>
#include <vector>
typedef long long ll;
using namespace std;
 
int main(){
  int n,m;
  cin>>n>>m;
  int ans=0;
  vector<vector<int>> swi(m);
  vector<int> p(m);
  for(int i=0;i<m;i++){
    int k;
    cin>>k;
    for(int j=0;j<k;j++){
      int s;
      cin>>s;
      swi[i].push_back(s);
    }
  }
  for(int i=0;i<m;i++) cin>>p[i];

  for(int bit=0;bit<(1<<n);bit++){//n桁以下の2進数
    vector<int> s_c(m);
    for(int j=0;j<n;j++){
      if(bit>>j&1){
        for(int i=0;i<m;i++){
          for(int k=0;k<swi[i].size();k++){
            if(swi[i][k]==j+1) s_c[i]++;
          }
        }
      }
    }
    for(int l=0;l<m;l++){
      s_c[l]%=2;
      if(s_c[l]!=p[l]) break;
      if(l==m-1){
        ans++;
      }
    }
  }
  cout<<ans<<endl;
}

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

#define si static inline
#define gcu getchar_unlocked
si int in() {
	int c, n = 0;
	//bool minus = false;
	//if ((c = gcu()) == '-') minus = true; else ungetc(c, stdin);
	while ((c = gcu()) >= '0' && c <= '9') n = 10 * n + (c - '0');
	return n; }
	//return minus ? -n : n; }
si void scan(char *s) {while (!isspace(*s++ = gcu()));}
#define pcu putchar_unlocked
#define svo si void out
template <typename T>
svo(T n) {
	static char buf[20];
	char *p = buf;
	//if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
svo(const char *s){while(*s)pcu(*s++);}
svo(char *s){while(*s)pcu(*s++);}
svo(char c){pcu(c);}
template <typename T>
//svo(vector<T> &v){for(T &x:v)out(' '),out(x);out('\n');}
svo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
template <typename head, typename... tail>
svo(head&& h, tail&&... t){out(h);out(move(t)...);}

struct union_find {
	struct node {int p, r = 1;};
	vector<node> nodes;

	union_find(int n) : nodes(n) {
		int i = 0;
		for (node &n: nodes)
			n.p = i++;
	}
	int find(int x) {
		int &p = nodes[x].p;
		if (p == x)
			return x;
		else {
			p = find(p);
			return p;
		}
	}
	void unite(int a, int b) {
		int ar = find(a), br = find(b);
		node &an = nodes[ar], &bn = nodes[br];
		if (an.r > bn.r) {
			bn.p = ar;
			an.r += bn.r;
		} else if (ar != br) {
			an.p = br;
			bn.r += an.r;
		}
	}
	bool equal(int a, int b) {
		return find(a) == find(b);
	}
};

int main() {
	union_find u(in());
	int n = in();
	while(n--) {
		int a = in();
		u.unite(a, in());
	}
	int q = in();
	while (q--)
		out(u.equal(in(), in()) ? "yes" : "no", '\n');
}


Measured memory_bytes: 3100
a,b=[int(i) for i in input().split()]

def odd(x):
    ones = (x+1)//2
    if(ones%2):
        return 1
    return 0

def even(x):
    ones = x//2

    if(ones%2):
        return (1^x)
    else:
        return x

if(b%2):
    fir = odd(b)
else:
    fir = even(b)
if((a-1)%2):
    sec = odd(a-1)
else:
    sec = even(a-1)

print((fir)^(sec))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define mod -1000000007
using namespace std;
typedef pair<int,int> pi;
typedef long long int ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    string a,b;
    cin>>n>>a; n--;
    map<string,bool> ch;
    ch[a] = true;
    while (n--) {
        cin>>b;
        if (ch[b] || a[-1+a.size()]!=b[0]) {
            cout<<"No";
            return 0;
        }
        ch[b] = true;
        a = b;
    }
    cout<<"Yes";
}


Measured memory_bytes: 256
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int n, m, l;
	LinkedList<E>[] Edge;
	
	@SuppressWarnings("unchecked")
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			n = sc.nextInt();
			m = sc.nextInt();
			l = sc.nextInt();
			if( (n|m|l) == 0 ) break;
			
			Edge = new LinkedList[n];
			for(int i=0;i<n;i++) Edge[i] = new LinkedList<E>();
			
			for(int i=0;i<m;i++) {
				int a = sc.nextInt()-1;
				int b = sc.nextInt()-1;
				int d = sc.nextInt();
				int e = sc.nextInt();
				Edge[a].add(new E(b, d, e));
				Edge[b].add(new E(a, d, e));
			}
			
			System.out.println(solve());
		}
	}
	
	int solve() {
		PriorityQueue<Node> que = new PriorityQueue<Node>();
		que.add(new Node(0, l, 0));
		int vis[][] = new int[n][l+1];
		for(int[] a: vis) fill(a, INF);
		fill(vis[0], 0);
		
		for(;;) {
			Node now = que.remove();
//			for(Node node: que) debug(node.n, node.l, node.e);
//			debug(" ", now.n, now.l, now.e);
			if(now.n == n-1 ) return now.e;
			if( vis[now.n][now.l] != now.e ) continue;
			
			for(E e: Edge[now.n]) {
//				debug(now.l, e.d);
				if( vis[e.t][now.l] > now.e + e.e ) {
					que.add( new Node(e.t, now.l, now.e + e.e) );
					vis[e.t][now.l] = now.e + e.e;
				}
				if( now.l >= e.d ) {
//					debug("a");
					if( vis[e.t][now.l-e.d] <= now.e ) continue;
					que.add( new Node(e.t, now.l-e.d, now.e) );
					vis[e.t][now.l-e.d] = now.e;
				}
			}
		}
	}
	
	class Node implements Comparable<Node>{
		int n, l, e;
		
		Node(int n, int l, int e) {
			this.n = n;
			this.l = l;
			this.e = e;
		}
		
		@Override
		public int compareTo(Node o) {
			// TODO 自動生成されたメソッド・スタブ
			return e - o.e;
		}
	}
	
	class E {
		int t, d, e;
		E(int t, int d, int e) {
			this.t = t;
			this.d = d;
			this.e = e;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 13000
n = int(input())
oisisa = list(map(int,input().split()))
oisisa_2 = []
for i in range(n):
    oisisa_2.append(oisisa[i] ** 2)
sum_2 = sum(oisisa_2)
count = 0
for i in range(n):
    for j in range(n):
        count += oisisa[i] * oisisa[j]
print(int((count - sum_2) / 2))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  vector<pii> A;
  rep(i, n){
    int a; cin >> a;
    A.push_back(mp(a,i));
  }
  sort(all(A)); reverse(all(A));
  int max_index = A[0].second;
  rep(i, n){
    if(i == max_index) std::cout << A[1].first << '\n';
    else std::cout << A[0].first << '\n';
  }
}


Measured memory_bytes: 3312
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        
        if(n == m){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21972
using System;
using System.Linq;
using static System.Console;

namespace Contest
{
    class Program
    {
        public static void Main(string[] args)
        {
            var data = ReadLine().Split().Select(int.Parse).ToArray();
            var dice = new Dice(data);
            var q = int.Parse(ReadLine());
            for (int i = 0; i < q; i++)
            {
                var tmp = ReadLine().Split().Select(int.Parse).ToArray();
                int top = tmp[0], forward = tmp[1];
                SearchNumber(dice, top, forward);
                WriteLine(dice.GetNumber(2));
            }
        }

        public static void SearchNumber(Dice dice, int top, int forward)
        {
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    if (dice.GetNumber() == top && dice.GetNumber(1) == forward) return;
                    if (dice.GetNumber(1) == forward) break;
                    dice.RollDice('N');
                }
                dice.RollDice('W');
            }
            WriteLine("Not found");
        }
    }

    class Dice
    {
        public int[] Data { get; set; }
        public int X { get; set; } = 0;
        public int Y { get; set; } = 0;
        public Dice(int[] data)
        {
            Data = data;
        }

        public void RollDice(char c)
        {
            // 0: Top
            // 5: Bottom
            // 1: Forward
            // 4: Back
            // 3: Left
            // 2: Right
            int tmp;
            switch (c)
            {
                case 'N': { tmp = Data[0]; Data[0] = Data[1]; Data[1] = Data[5]; Data[5] = Data[4]; Data[4] = tmp; break; }
                case 'S': { tmp = Data[0]; Data[0] = Data[4]; Data[4] = Data[5]; Data[5] = Data[1]; Data[1] = tmp; break; }
                case 'W': { tmp = Data[0]; Data[0] = Data[2]; Data[2] = Data[5]; Data[5] = Data[3]; Data[3] = tmp; break; }
                case 'E': { tmp = Data[0]; Data[0] = Data[3]; Data[3] = Data[5]; Data[5] = Data[2]; Data[2] = tmp; break; }
                default: break;
            }
        }

        public int GetNumber(int number = 0)
        {
            return Data[number];
        }

    }
}


Measured memory_bytes: 18384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <utility>
using namespace std;


int n;
int ans;
int sz;
vector<vector<int> > dices;


int count(){
	int ret = 0;

	for(int j = 1; j <= 6; ++j){
		vector<int> c(sz);
		for(int i = 0; i < n; ++i){
			++c[ dices[i][j] ];
		}
		
		int m = *max_element(c.begin(), c.end());
		
		ret += n - m;
	}
	
	return ret;
}


void rollfront(vector<int> &dice){
	int next[7] = {
		-1,
		dice[3],
		dice[2],
		dice[6],
		dice[1],
		dice[5],
		dice[4],
	};
	copy(next, next + 7, dice.begin());
}

void rollright(vector<int> &dice){
	int next[7] = {
		-1,
		dice[1],
		dice[3],
		dice[5],
		dice[2],
		dice[4],
		dice[6],
	};
	copy(next, next + 7, dice.begin());
}

void round(vector<int> &dice){
	int next[7] = {
		-1,
		dice[5],
		dice[1],
		dice[3],
		dice[4],
		dice[6],
		dice[2],
	};
	copy(next, next + 7, dice.begin());
}


void func(int x){
	if( x == n ){
		ans = min(ans, count());
	}
	else{
		for(int i = 1; i <= 6; ++i){
			for(int j = 0; j < 4; ++j){
				func(x + 1);
				round( dices[x] );
			}
			
			if( i & 1 ){
				rollfront( dices[x] );
			}
			else{
				rollright( dices[x] );
			}
		}
	}
}


int main(){
	while( cin >> n, n != 0 ){
		vector<vector<string> > s(n + 1, vector<string>(7) );
		map<string,int> mp;

		for(int i = 0; i < n; ++i){
			for(int j = 1; j <= 6; ++j){
				cin >> s[i][j];
				mp.insert( make_pair(s[i][j], mp.size() ) );
			}
		}
		
		sz = mp.size();

		dices.resize(n, vector<int>(7, -1));
		for(int i = 0; i < n; ++i){
			for(int j = 1; j <= 6; ++j){
				dices[i][j] = mp[ s[i][j] ];
			}
		}
		
		ans = 99;
		func(1);
		
		cout << ans << '\n';
	}
}

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

int main() {
  int K,S;
  cin >> K >> S;
  int count = 0;
  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K; j++) {
      int k = S - i - j;
      if (k >= 0 && k <= K) count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls signed
#define give main()
const int mod = 1000000007;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

#pragma endregion

const int N = 55;

pls give {
    AC;
    int a, b, c, d;
    cin >> a;
    if (a/100 == 7 or (a%100)/10 == 7 or (a%100%10) == 7) cout << "Yes" << nl;
    else cout << "No" << nl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cmath>
#include <map>
#include <set>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define popb(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  int x,a,b;
  cin>>x>>a>>b;
  if(b-a<=0){
    cout<<"delicious"<<endl;
  }else{
    if(x-(b-a)>=0){
      cout<<"safe"<<endl;
    }else{
      cout<<"dangerous"<<endl;
    }
  }
}


Measured memory_bytes: 256
/**
*	  Name: Ajay
*	  Institute: IIITH 
*/

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <ctime>
#include <string.h>
#define ll long long
#define inf 0x7fffffff
#define mod 1000000007
#define pb push_back
#define ppi pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vii vector<ppi>
#define vll vector<ll>
#define mp make_pair
#define fi first
#define se second
using namespace std;

void fastio()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void input()
{
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
}

int main()
{      
  fastio();
  int n,m,i,j,t;
  cin>>n;
  int A[n];
  for(i=0;i<n;i++)
  	cin>>A[i];
   sort(A,A+n);  
  
    int count = 0; 
      
    for(i = n-1; i >= 1; i--)
    { 
        int l=0,r=i-1; 
        while(l<r)
        { 
            if(A[l]+A[r]>A[i])
            { 
                count+=r-l;
                r--;   
            } 
            else 
               l++;   
        } 
    } 
  cout<<count; 
  return 0;
}

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

int main() {
	int n,m,c,res=0;
	cin>>n>>m>>c;
	vector<int> b;
	for(int i=0;i<m;i++){
		int in;cin>>in;
		b.push_back(in);
	}
	for(int i=0;i<n;i++){
		int sum=0;
		for(int j=0;j<m;j++){
			int a;
			cin>>a;
			sum+=b.at(j)*a;
		}
		if(sum+c>0)res++;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef unsigned long long ll;



int main(){
 string S,T;
 int flag = 1;
 cin >> S;
 cin >> T;

  for (int i = S.length()-T.length()+1; i>=0; --i){
    flag = 1;
    for(int j=0; j < T.length(); j++){
      if(S[i+j]!= T[j] && S[i+j]!='?'){
        flag=0;
      }
    }
    if(flag){
      for(int j=0; j < T.length(); j++){
        S[i+j]=T[j];
      }
      for(int j = 0; j < S.length(); j++){
      if(S[j] == '?')
        S[j]='a';
      }
      cout << S << endl;
      return 0;
    }
  }

  if(!flag){
    cout << "UNRESTORABLE\n";
  }
  
    
  return 0;
}



Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! chmax {
    ($x:expr, $e:expr) => {
        if $x < $e {
            $x = $e;
        }
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        if $x > $e {
            $x = $e;
        }
    };
}

const INF: i64 = 1 << 60;

fn main() {
    input!{
        H: usize,
        W: usize,
        S: [chars; H],
    }
    let mut v = vec![vec![0; W]; H];
    for j in 0..H {
        let mut cnt = 0;
        for i in (0..W).rev() {
            if S[j][i] == '#' {
                if cnt != 0 {
                    v[j][i+1] = cnt;
                    cnt = 0;
                }
                continue;
            }
            cnt += 1;
        }
        if cnt != 0 {
            v[j][0] = cnt;
        }
    }
    for j in 0..H {
        for i in 0..W {
            if i == 0 || S[j][i] == '#' {
                continue;
            }
            v[j][i] += v[j][i-1];
        }
    }
    let mut h = vec![vec![0; W]; H];
    for i in 0..W {
        let mut cnt = 0;
        for j in (0..H).rev() {
            if S[j][i] == '#' {
                if cnt != 0 {
                    h[j+1][i] = cnt;
                    cnt = 0;
                }
                continue;
            }
            cnt += 1;
        }
        if cnt != 0 {
            h[0][i] = cnt;
        }
    }
    for i in 0..W {
        for j in 0..H {
            if j == 0 || S[j][i] == '#' {
                continue;
            }
            h[j][i] += h[j-1][i];
        }
    }
    let mut ans = 0;
    for j in 0..H {
        for i in 0..W {
            chmax!(ans, v[j][i] + h[j][i] - 1);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 57592
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

int a, b;
map<int, int> m;

void calc()
{
	if (!(m[1] % 2 == 1 && m[2] % 2 == 1))
	{
		cout << "NG" << endl;
		m.clear();
		return;
	}
	
	m[1] = m[2] = 2;	//2の倍数にする

	bool flag = true;	//最終的にtrueなら条件を満たす
	for (map<int, int>::iterator it=m.begin(); it!=m.end(); it++)
	{
		if (it->second % 2 != 0) flag = false;
	}

	m.clear();

	if (flag)
	{
		cout << "OK" << endl;
	} else {
		cout << "NG" << endl;
	}

	return;
}

int main()
{
	while (cin >> a >> b)
	{
		if (a == 0 && b == 0)
		{
			calc();
			continue;
		}
		m[a]++;
		m[b]++;
	}
	
	return 0;
}

Measured memory_bytes: 1188
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>

using namespace std;
using ll = long long int;


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

  map<int, int> m;

  for(int i=0;i<n;i++){
    int x;
    cin>>x;

    m[x]++;
    if(m[x]>1){
      cout<<"NO"<<endl;
      return 0;
    }
  }

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

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

using i64 = int64_t;

constexpr int INF = 1e9;

int dist[200005]={0};

void init(int n){
    for(int i=0;i<=n;++i)
        dist[i] = INF;
}

pair<int, int> dfs(int s, int d, const vector<vector<int>> &graph){
    if(dist[s] < INF)return make_pair(s, dist[s]);
    dist[s] = d;
    auto res = make_pair(s, d);
    for(auto to: graph[s]){
        auto p = dfs(to, d+1, graph);
        if(res.second < p.second)
            res = p;
    }
    return res;
}

int compute_diameter(int n, const vector<vector<int>> &graph){
    init(n);
    auto p = dfs(1, 0, graph);
    init(n);
    p = dfs(p.first, 0, graph);
    return p.second;
}

int main(){
    int n;
    cin >> n;
    vector<vector<int>> graph(n+1, vector<int>());

    for(int i=0;i<n-1;++i){
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    int d = compute_diameter(n, graph);

    cout << (d%3 == 1 ? "Second" : "First") << endl;

    return 0;
}


Measured memory_bytes: 27648
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <limits>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int solve()
{
    int A, B;

    std::cin >> A >> B;

    if (B == 1) return 0;

    int counter = 1;
    B -= A;

    if (B > 0)
    {
        counter += B / (A - 1);
        counter += (B % (A - 1) != 0);
    }

    return counter;
}

int main()
{
    std::cout << solve() << std::endl;

    return 0;
}


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

int count=0;


void select_sort(int *A,int n,int g){
  int i,j;
  int key;
  for(i=g;i<n;i++){
    j=i;
    key=A[i];
    while(0 <= j-g){
      if(A[j-g] <= key) break;
      A[j]=A[j-g];
      j-=g;
      count+=1;
    }
   A[j]=key;
 }
}
  

int main(){
  int n;
  int i,j;
  int *A;
  int G[20];

  scanf("%d",&n);
  A=malloc(n*sizeof(int));
  for(i=0;i<n;i++) scanf("%d",&A[i]);
 
  int m=0;
  G[0]=0;
  while(1){
    if(n < 3*G[m]+1) break;
    G[m+1]=3*G[m]+1;
    m+=1;
 }
 
 for(i=m;i>0;i--) select_sort(A,n,G[i]);
 
  printf("%d\n",m);
  printf("%d",G[m]);
  for(i=m-1;i>=1;i--) printf(" %d",G[i]);
  printf("\n");
  printf("%d\n",count);

 
  for(i=0;i<n;i++) printf("%d\n",A[i]);
  return 0;
}
 


Measured memory_bytes: 5692
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N;

int main()
{
	in >> N;
	out << (N >= 1000 ? "ABD" : "ABC") << std::endl;
	return 0;
}


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

int main() {
    int n;
    int left = 0;
    int right = 0;
    string s;
    cin >> n >> s;

    for (int i = 0; i < n; i++) {
        if (s[i] == '(') {
            left++;
        } else {
            if (left <= 0) {
                right++;
            } else {
                left --;
            }
        }
    }
    /* cout << right << left << endl; */
    for (int i = 0; i < right; i++) {
        cout << "(" << flush;
    }
    cout << s << flush;
    for (int i = 0; i < left; i++) {
        cout << ")" << flush;
    }
    cout << endl;

    return 0;
}



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

using namespace std;

int main(){
  string t;
  cin >> t;
  
  for(int i=0;i<t.length();i++){
    if(t.at(i)=='?')
      t.at(i)='D';
  }
  
  cout << t << endl;
  
  return 0;
}


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n; cin >> n;
    vl x(n),y(n),h(n);
    int idx;
    rep(i,n)cin>>x[i]>>y[i]>>h[i];
    rep(i,n)if(h[i] != 0)idx = i;
    
    rep(i,101){
        rep(j,101){
            ll res = h[idx]+abs(x[idx]-i)+abs(y[idx]-j); //ピラミッドの高さ
            bool check = true; //矛盾がないか
            rep(k,n){
            ll nx = abs(x[k]-i);
            ll ny = abs(y[k]-j);
                if(h[k] > 0){
                    if(res != (h[k]+nx+ny))check = false;
                }
                else{
                    if(res - nx - ny > 0)check = false;
                }
            }
            if(check){
                cout << i << " " << j << " " << res << endl;
                return 0;
            }
        }
    }
}


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

int main()
{
        string s;
        string t;
        string u;
        int a;
        int b;

        cin >> s >> t;
        cin >> a >> b;
        cin >> u;

        if (s == u) {
                a--;
        }
        else if (t == u) {
                b--;
        }
        cout << a << " " << b << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;int64_t N,a,b,c,i,V[1<<20],f[1<<20],R[1<<20];main(){for(cin>>N;i<N;cin>>a>>b,a+=1e9,R[i++]=(a<<32)+a+b);for(sort(R,R+N);a=i--;c=V[i]=(c+V[f[i]=a]+1)%998244353)for(;a<N&R[a]<R[i]<<32;a=f[a]);cout<<c+1;}

Measured memory_bytes: 5888
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0;i<s.length();i++){
        for(int j=1;i+j<=s.length();j++){
            string tmp = s.substr(i,j);
            bool chk = true;
            for(int k=0;k<tmp.length();k++){
                if(tmp[k] != 'A' && tmp[k] !='G' && tmp[k] != 'C' && tmp[k] != 'T')chk = false;
            }
            if(chk && ans < tmp.length())ans = tmp.length();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int H, W;
	cin >> H >> W;
	vector<string>s(H);
	int dx[4] = { 1,0,-1,0 };
	int dy[4] = { 0,1,0,-1 };
	rep(i, H)cin >> s[i];
	vector<vector<int>>d(H, vector<int>(W, INF));
	queue<P>q;
	q.push(P(0, 0));
	d[0][0] = 0;
	while (q.size()) {
		P p = q.front();
		q.pop();
		if (p.first == (H - 1) && p.second == (W - 1)) {
			int whitesum = 0;
			rep(i, H)rep(j, W)if (s[i][j] == '.')whitesum++;
			cout << whitesum - d[H - 1][W - 1] - 1;
			return 0;
		}
		for (int i = 0; i < 4; i++) {
			int nx = p.first + dx[i];
			int ny = p.second + dy[i];
			if (0 <= nx && nx < H && 0 <= ny && ny < W && s[nx][ny] != '#' && d[nx][ny] == INF) {
				q.push(P(nx, ny));
				d[nx][ny] = d[p.first][p.second] + 1;
			}
		}
	}
	cout << -1;
}

Measured memory_bytes: 256
package main

import (
    "fmt"
)

func main() {
    var n int 
    fmt.Scan(&n)
    var sum int 
    for i := 0; i < n; i++ {
        var a int 
        fmt.Scan(&a)
        sum += a - 1 
    }   
    fmt.Println(sum)
}


Measured memory_bytes: 640
n = int(input())
a = int(input())
b= int(input())
c= int(input())
d= int(input())
e= int(input())
neck =min(a,b,c,d,e)
ans = 5

if n%neck==0:
    nt = n//neck -1
else:
    nt = n//neck
ans += nt
print(ans)

Measured memory_bytes: 3064
/* 
 * Project: AtCoder Beginners Contest 146 A - Can't Wait for Holiday / 
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/08/07
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstring>
using namespace std;

char s[3];

void solve() {

    const char *week[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

    for (int i=0;i<7;i++) {
        if (strcmp(s, week[i]) == 0) {
            printf("%d\n", 7-i);
            return;
        }
    }

}

int main() {

    scanf("%s", s);

    solve();

}

Measured memory_bytes: 3168
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<math.h>

#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll a,b;
    cin >> a >> b;
    int count = 0;
    while(a!=0){
        a/=b;
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n;
  scanf("%d",&n);
  
  int rate[101];
  int count[8] = {0} , max = 0;
  for(int i = 0;i < n;i ++){
    scanf("%d",&rate[i]);
    if(1<=rate[i]&&rate[i]<=399){
      count[0] ++;
    }
    else if(rate[i] <= 799){
      count[1] ++;
    }
    else if(rate[i] <= 1199){
      count[2] ++;
    }
    else if(rate[i] <= 1599){
      count[3] ++;
    }
    else if(rate[i] <= 1999){
      count[4] ++;
    }
    else if(rate[i] <= 2399){
      count[5] ++;
    }
    else if(rate[i] <= 2799){
      count[6] ++;
    }
    else if(rate[i] <= 3199){
       count[7] ++;
    }
    else{
      max ++;
    }
  }

  int ans = 0;
  for(int i = 0;i < 8;i ++){
    if(count[i] != 0){
      ans ++;
    }
  }
  if(ans == 0){
    printf("1  %d",max);
  }

  else{
    printf("%d   %d",ans,ans+max);
  }

  return 0;
}

Measured memory_bytes: 128
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

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

Measured memory_bytes: 1164