akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num))+1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl;
#define dpa(v) cerr << "[ " << endl;REPI(itr, v) { cerr << "  [" << (*itr).first << ", " << (*itr).second << ']' << (itr != --v.end() ? "," : "") << endl; } cerr << "]" << endl;


signed main(){
  int N, M, X; cin >> N >> M >> X;
  vector<int> C(N);
  V2(A, N, M);
  REP(x, N) {
    REP(y, M+1) {
      if (y == 0) {
        cin >> C.at(x);
      } else {
        cin >> A.at(x).at(y-1);
      }
    }
  }

  vector<int> bits(N+1);
  int minValue = __LONG_LONG_MAX__;
  REP(bit, (1<<N)) {
    REP(x, N) {
      if(bit & (1<<x)) bits.at(x+1) = true;
      else bits.at(x+1) = false;
    }

    vector<int> tmpA(M);
    int valueSum = 0;
    REP(z, N){
      if (bits.at(z+1)) {
        REP(x, M){
          tmpA.at(x) += A.at(z).at(x);
        }
        valueSum += C.at(z);
      }
    }
    bool isValid = true;
    REP(x, M) {
      if (tmpA.at(x) < X) isValid = false;
    }

      // da(bits);
      // da(tmpA);
      // dv("valueSum", valueSum);
      // cerr << endl;
    if (isValid) {
      minValue = min(minValue, valueSum);
    }
  }

  cout << (minValue != __LONG_LONG_MAX__ ? minValue : -1) << endl;

}


Measured memory_bytes: 3624
import sys
import copy
import  math
import bisect
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, k = na()
lll = na()
list.sort(lll, reverse=True)
print(sum(lll[:k]))

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

#109_c
import numpy as np
import math
from functools import reduce
from fractions import gcd

#最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

N, X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]

x.append(X)
sort_x = np.array(sorted(x))

kaisa = np.diff(sort_x, n=1).tolist()

print(gcd_list(kaisa))


Measured memory_bytes: 24956
#include <cmath>
#include <cstdint>
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
  int64_t N, K;
  cin >> N >> K;
  
  long double per = 0.0;
  for (int64_t n = 1; n <= N; ++n) {
    long double tmp = 1.0 / N;
    int64_t now = n;
    while (now < K) {
      now *= 2;
      tmp /= 2.0;
    }
    per += tmp;
  }
  cout << fixed << setprecision(12);
  cout << per << endl;
  
  return 0;
}


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

int main() {
  string s,t;cin>>s>>t;
  rep(i,s.size()){
    s=s.substr(1)+s[0];
    if(s==t){
      cout<<"Yes"<<endl;
    return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3576
#include<iostream>
#include<cstring>
#include<set>
#define ll long long
using namespace std;
string s,temp,y;
ll len,ans,cnt[30],sum;
int main()
{
	cin>>s,len=s.length();
	ans=len*(len-1)/2,s=" "+s;
	for(int i=1;i<=len;i++) sum+=cnt[s[i]-'a'+1],cnt[s[i]-'a'+1]++;
	printf("%lld\n",ans-sum+1);
	return 0;
}

Measured memory_bytes: 772
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



int main(){
  int a, b, c, k;
  cin >> a >> b >> c >> k;

  REP(m,k){
    int bx = b;
    int cx = c;

    REP(i,m){
      bx *= 2;
    }
    REP2(i,m,k){
      cx *= 2;
    }

    //cout << m << " "<< bx << " " << cx << endl;

    if(a < bx && bx < cx){
      cout << "Yes" << endl;
      return 0;
    }
  }

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

}


Measured memory_bytes: 3632
import Control.Monad
import Control.Applicative
import Data.List
import qualified Data.Map as Map
import Data.Array
import qualified Data.ByteString.Char8 as BC
import Data.Maybe
import qualified Data.Set as Set
import qualified Data.Sequence as Sq
import qualified Data.IntMap as IMap
import Data.Sequence (ViewL(..),ViewR(..),(><),(<|),(|>),Seq)

bsreadInt :: BC.ByteString -> Int
bsreadInt = fst . fromJust . BC.readInt

main = do
    n <- readLn :: IO Int
    print $ n `div` 3

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    while(cin >> n){
        vi d(1 << n);
        REP(i, 1 << n) {
            cin >> d[i];
        }
        vector<vector<pii>> dp(1 << n);
        REP(i, 1 << n) {
            dp[i].emplace_back(d[i], i);
            REP(j, n) {
                if (i & (1 << j)) {
                    dp[i].insert(dp[i].end(), ALL(dp[i - (1 << j)]));
                }
            }
            sort(RALL(dp[i])); UNIQUE(dp[i]);
            if(dp[i].size() > 2) dp[i].resize(2);
        }
        int ans = 0;
        REPS(i, (1 << n) - 1) {
            ans = max(ans, dp[i][0].first + dp[i][1].first);
            cout << ans << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 70656
x = int(input())
prime = [True for i in range(1000000)]
prime[0] = prime[1] = False
for i in range(200000):
    if prime[i]:
        for j in range(i+i, 200000, i):
            prime[j] = False
for i in range(x, 200000):
    if prime[i]:
        print(i)
        break

Measured memory_bytes: 114544
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

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

    int R;
    cin >> R;

    cout << 2 * R * M_PI << endl;
}

Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define yoi cout<<"yo"<<endl;
#define debug(i) cout<<i<<endl;
const lli inf=1e18;
const int mod=1e9 +7;
lli dp[1<<16];
lli prefix[1<<16];
lli n;
void recurse(lli i,lli mask,vector<lli>& excluded,lli sum,lli group){
if(i==excluded.size()){
    dp[mask|group]=max(dp[mask|group],dp[mask]+sum);
    return ;
}
recurse(i+1,mask,excluded,prefix[group],group);
recurse(i+1,mask,excluded,prefix[group|1<<excluded[i]],group|1<<excluded[i]);
}
int main(){
IOS;
lli i,j,k;
cin>>n;
lli a[n][n];
for(i=0;i<n;i++){
    for(j=0;j<n;j++){
        cin>>a[i][j];
    }
}
lli limit=1<<n;
lli sum=0;
for(i=0;i<limit;i++){
    dp[i]=-inf;
}
dp[0]=0;
for(i=0;i<limit;i++){
        sum=0;
    for(j=0;j<n;j++){
        if(i&1<<j){
            for(k=j+1;k<n;k++){
                if(i&1<<k){
                    sum+=a[j][k];
                }
            }
        }
    }
    prefix[i]=sum;
}
for(i=0;i<limit;i++){
        vector<lli> excluded;
    for(j=0;j<n;j++){
        if(!(i&(1<<j))){
            excluded.pb(j);
        }
    }
    //cout<<i<<" ";
    recurse(0,i,excluded,0,0);
}
cout<<dp[limit-1]<<endl;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
  ll n;
  cin >> n;
  vector<vector<ll>> num(10, vector<ll>(10, 0));
  
  
  for(int i=1; i<=n; i++){
    vector<int> d;
    int nn = i;
    while(nn){
      d.push_back(nn%10);
      nn /= 10;
    }
    
    int a = d[0];
    int b = d.back();
    if(!a || !b) continue;
    
    num[a][b]++;
  }
  
  ll  res = 0;
  for(int a=1; a<10; a++){
    for(int b=1; b<10; b++){
      res += num[a][b]*num[b][a];
    }
  }
  
  
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 3596
N = int(input())  
A = list(map(int,input().split()))
Q = int(input())
Query = [list(map(int,input().split())) for _ in range(Q)]

ls = [0]*(10**5+1)
for i in range(N):
    ls[A[i]] += 1

S = sum(A)    
for i in range(Q):
    b = Query[i][0]
    c = Query[i][1]
    S += ((c - b) * ls[b])
    ls[c] += ls[b]
    ls[b] = 0
    print(S)

Measured memory_bytes: 32060
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
input = sys.stdin.readline


def main():
    n, k, l = map(int, input().split())
    p, q = [], []
    for _ in range(k):
        pi, qi = map(int, input().split())
        p.append(pi)
        q.append(qi)
    r, s = [], []
    for _ in range(l):
        ri, si = map(int, input().split())
        r.append(ri)
        s.append(si)

    road_tree = make_union_find(p, q, n)
    rail_tree = make_union_find(r, s, n)

    a, b = [], []
    x = defaultdict(int)
    for i in range(n):
        a.append(root(road_tree, i))
        b.append(root(rail_tree, i))
        key = (a[i], b[i])
        x[key] += 1

    for i in range(n):
        print(x[(a[i], b[i])], end=' ')

    # print("\n")
    # print(road_tree)
    # print(rail_tree)


def make_union_find(a, b, n):
    union_find_tree = [i for i in range(n)]

    for i in range(len(a)):
        x = root(union_find_tree, a[i] - 1)
        y = root(union_find_tree, b[i] - 1)
        if x != y:
            union_find_tree[x] = min(x, y)
            union_find_tree[y] = union_find_tree[x]

    return union_find_tree


# def make_union_find(a, b, n):
#     x = [i for i in range(n)]

#     for i in range(len(a)):
#         root = a[i] - 1
#         leaf = b[i] - 1
#         x[leaf] = root
#     return x


def root(union_find_tree, target):
    if union_find_tree[target] == target:
        return target
    else:
        union_find_tree[target] = root(
            union_find_tree, union_find_tree[target])
        return union_find_tree[target]


if __name__ == '__main__':
    main()


Measured memory_bytes: 72940
#include <cstdio>
#include <map>
#include <algorithm>
using namespace std;

struct Incubator
{
  static const int H = 20;
  static const int BASE = (1<<(H-1));
  int tree[1<<H];
  int limit;
  map<int,int> m;
  int rev[400000];

  void init(int l)
  {
    fill_n(tree, 1<<H, 0);
    fill_n(rev, 400000, -1);
    limit = l;
    m.clear();
  }

  void add(int idx, int v)
  {
    while (idx != 0) {
      tree[idx-1] += v;
      idx >>= 1;
    }
  }

  void incubate(int x)
  {
    if (tree[0] == limit) {
      enkan_idx(0);
    }
    const int i = m.size();
    m[x] = i;
    rev[i] = x;
    add(i + BASE, 1);
  }

  void enkan(int x)
  {
    add(m[x] + BASE, -1);
  }

  void enkan_idx(int n)
  {
    add(find(n), -1);
  }

  int query(int n) const
  {
    return rev[find(n) - BASE];
  }

  int find(int n) const
  {
    int idx = 1;
    while (idx < BASE) {
      const int l = idx<<1;
      const int r = l+1;
      if (n < tree[l-1]) {
        idx = l;
      } else {
        idx = r;
        n -= tree[l-1];
      }
    }
    return idx;
  }
};

int main()
{
  static Incubator qb;
  int Q, L;
  while (scanf("%d %d", &Q, &L) != EOF && Q != 0) {
    qb.init(L);
    for (int i = 0; i < Q; i++) {
      int q, x;
      scanf("%d %d", &q, &x);
      switch (q) {
        case 0:
          qb.incubate(x);
          break;
        case 1:
          qb.enkan_idx(x-1);
          break;
        case 2:
          printf("%d\n", qb.query(x-1));
          break;
        case 3:
          qb.enkan(x);
          break;
      }
    }
    puts("end");
  }
  return 0;
}

Measured memory_bytes: 0
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {

    let n: i32 = read();

    if n % 2 == 0 {
        println!("{}", n);
    } else {
        println!("{}", n * 2);
    }
}


Measured memory_bytes: 4352
//AtCoder ABC059 C - Sequence
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
#if LOCAL&0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    int n;
    cin>>n;
    vector<ll> atbl(n);
    vector<ll> sum(n,0);
    for(auto&& a:atbl){
        cin>>a;
    }
    ll ad=0;
    for(int i=0;i<atbl.size();++i){
        ad+=atbl[i];
        sum[i]=ad;
    }
    auto check1 = [&](){
        ll ans=0;
        ll cur=0;
        for(int i=0;i<sum.size();++i){
            auto cur_sum=sum[i]+cur;
            if(i%2){
                if(cur_sum>=0) {
                    auto c=cur_sum+1;
                    cur -= c;
                    ans += abs(c);
                }
            }else{
                if(cur_sum<=0){
                    auto c=cur_sum-1;
                    cur -= c;
                    ans += abs(c);
                }
            }
        }
        return ans;
    };
    auto check2 = [&](){
        ll ans=0;
        ll cur=0;
        for(int i=0;i<sum.size();++i){
            auto cur_sum=sum[i]+cur;
            if(i%2){
                if(cur_sum<=0){
                    auto c=cur_sum-1;
                    cur -= c;
                    ans += abs(c);
                }
            }else{
                if(cur_sum>=0) {
                    auto c=cur_sum+1;
                    cur -= c;
                    ans += abs(c);
                }
            }
        }
        return ans;
    };
    cout<<min(check1(),check2())<<endl;
    return 0;
}

Measured memory_bytes: 1792
N, M = map(int, input().split())

cntAC = 0
cntWA = 0

AC = [0] * N
WA = [0] * N

for i in range(M):
    p, s = input().split()
    p = int(p) - 1

    if AC[p] == 0:
        if s == 'AC':
            cntAC += 1
            cntWA += WA[p]
            AC[p] += 1
        else:
            WA[p] += 1

print(cntAC, cntWA, sep=' ')


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

int main(){

    double n,k; cin >> n >> k;
    double ans = 0;

    for(double i=0;i<n;i++){
        double tmp = i+1.0;
        double count = 0.0;
        while(tmp<k){
            tmp *=2.0;
            count++;
        }
        
        ans += pow(1.0/2.0,count);
        
    }

    printf("%.12f\n",ans*1/n);

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
struct Unionfind{
    vector<int> rank,p,si;//木の高さの管理=rank,p=親の管理
    Unionfind(){}
        //初期化
    Unionfind(int size){
                rank.resize(size,0);
                p.resize(size,0);
              si.resize(size,1);
                for(int i=0;i<size;i++){
                        makeSet(i);
        }
    }
    void makeSet(int x){
                p[x]=x;//親を自分にする。
                rank[x]=0;//最初の高さは0
              si[x]=1;
    }
        //同じ集合か判定。
    bool same(int x,int y){
                return (findSet(x)==findSet(y));
    }
        //集合を併合
    void unite(int x,int y){
                link(findSet(x),findSet(y));
    }
    void link(int x,int y){
      if(x!=y){
              if(rank[x]<rank[y]){
                  p[x]=y;
                  si[y]+=si[x];
        }
              else{
                  p[y]=x;
                  if(rank[x]==rank[y]){
                     rank[y]++; 
            }
                  si[x]+=si[y];
        }
               
      }//cout<<rank[x]<<' '<<rank[y]<<'\n';
    }
          int siz(int x){
              int a=findSet(x); 
              return si[a];
    }             
        //経路圧縮
    int findSet(int x){
        //自分自身と親が等しくなるまで再帰
                if(x!=p[x]){
                        p[x]=findSet(p[x]);
                }
                return p[x];
    }
};
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    Unionfind uf(n);
    int a,b;
    rep(i,m){
        cin>>a>>b;
        uf.unite(a,b);
    }
    int p;
    cin>>p;
    rep(i,p){
        cin>>a>>b;
        if(uf.same(a,b)){
            cout<<"yes"<<'\n';
        }
        else{
            cout<<"no"<<'\n';
        }
    }
    return(0);
}


Measured memory_bytes: 4148
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif

template<class T = lint>
struct Edge {
	int from, to;
	T cost;
	Edge() {}
	Edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};

template<class T>
vector<T> Bellman_Ford(vector<Edge<T>> &edges, int V, int st) {

	const T INF = numeric_limits<lint>::max();
	vector<T> dist(V, INF);
	dist[st] = 0;
	for (int i = 0; i < V - 1; i++) {
		for (const auto &ele : edges) {
			if (dist[ele.from] == INF) continue;
			dist[ele.to] = min(dist[ele.to], dist[ele.from] + ele.cost);
		}
	}
  for (int i = 0; i < V - 1; i++) {
    for (const auto &ele : edges) { // finding negative loop
      if (dist[ele.from] == INF) continue;
      if (dist[ele.from] == -INF) dist[ele.to] = -INF; // src is nloop -> dst is nloop
      if (dist[ele.to] > dist[ele.from] + ele.cost) dist[ele.to] = -INF; // chmin is possible -> nloop
    }
  }
	return dist;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M, P;
	cin >> N >> M >> P;

	int a, b, c;
	vector<Edge<lint>> edges(M);
	for (int i = 0; i < M; i++) {
		cin >> a >> b >> c;
		a--, b--;
		edges[i] = { a, b, P - c };
	}

	auto dist = Bellman_Ford(edges, N, 0);
	DMP(dist);

	lint ans = -dist.back();
	if (ans == numeric_limits<lint>::max()) cout << "-1\n";
	else if (ans < 0) cout << "0\n";
	else cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 384
/*****************************************************

Code by: Vichitr
Compiled On: 2019

*****************************************************/

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define pb push_back
#define pf pop_front
#define mp make_pair
#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 301;

ll pow(ll x, ll y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return r;
}

ll add(ll x, ll y)
{
    ll r = x + y;
    return r % MOD;
}

ll sub(ll x, ll y)
{
    ll r = x - y;
    r = r % MOD;
    r = r + MOD;
    return r % MOD;
}

ll mul(ll x, ll y)
{
    ll r = x * y;
    r %= MOD;
    r += MOD;
    return r % MOD;
}

ll inv(ll x, ll y)
{
    return pow(x, y-2);
}

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

double solve(int c1, int c2, int c3)
{
    if(c1<0 or c2<0 or c3<0 or (c1==0 and c2==0 and c3==0))
        return 0;
    
    if(dp[c1][c2][c3] != -1)
        return dp[c1][c2][c3];
    double ans = 1;
    
    ans += c1*1.0*solve(c1-1, c2, c3)/n;
    ans += c2*1.0*solve(c1+1, c2-1, c3)/n;
    ans += c3*1.0*solve(c1, c2+1, c3-1)/n;
    ans *= n*1.0/(c1+c2+c3);
    return dp[c1][c2][c3] = ans;
}

int main()
{
    fast;

    cin>>n;
    int c1=0, c2=0, c3=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==1) c1++;
        else if(a[i]==2) c2++;
        else c3++;
    } 
    for(int i=0;i<=n;i++) for(int j=0;j<=n;j++) for(int k=0;k<=n;k++) dp[i][j][k] = -1;
    cout<<fixed<<setprecision(10);
    cout<<solve(c1, c2, c3);

    return 0;
}


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

int main()
{
    int a,b;
    cin>>a>>b;
    for(int i=1;i<10000;++i)
    {
        int a1, b1;
        a1 = i * 0.08;
        b1 = i * 0.1;
        if(a==a1 && b==b1)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<algorithm>
// #include<bits/stdc++.h>
#define INF 0x7f7f7f7f //2139062143
#define INF1 0x3f3f3f3f //1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.141592653589793//23846264338327950254
#define ft first
#define sd second
#define pb push_back
#define ll long long
#define vec vector<ll>
#define mat vector<vector<ll>>
//cout<<fixed<<setprecision(6)<<
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
//ifstream f1("/Users/wangzichao/Documents/wzc.in");
//ofstream f2("/Users/wangzichao/Documents/wzc.out");
//ios::sync_with_stdio(false);
//cin.tie(0);cout.tie(0);
using namespace std;
#define local
#ifdef local
#endif
const ll maxn=6e5+7;
const double eps=1e-10;
const ll mod=1e9+7;
#define STDIN freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);//************************************
#define Quick ios::sync_with_stdio(false);cin.tie(NULL);
 
// int main()
// {
//     STDIN
//     Quick
//     string s;
//     cin >> s;
//     string ans = "No";
//     for (int i = 0; i < 3; i++)
//     {
//         if (s[i] == '7')
//             {
//                 ans = "Yes";break;
//             }
//     }
//     cout << ans << endl;
//     return 0;
// }
 
// int main()
// {
//     STDIN
//     Quick
//     int n; cin >> n;
//     ll sum = 0;
//     for (int i = 1; i <= n; i++)
//     {
//         if (i%3 == 0 || i%5 == 0) continue;
//         sum += i;
//     }
//     cout << sum << endl;
// }
int gcd(int a, int b)
{
    return b?gcd(b, a%b):a;
}
int main()
{
    Quick;
    //STDIN;
    int k; cin >> k;
    ll sum = 0;
    for (int i = 1; i <= k; i++)
    {
        for (int j = 1; j <= k; j++)
        {
            for (int l = 1; l <= k; l++)
            {
                sum += gcd(gcd(i, j), l);
            }
        }
    }
    cout << sum << endl;
}

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

void solve(int n){
for (int i = 2; i*i <= n; i++){
if (n % i == 0) {
cout << i << " "; solve(n / i); return;
}
}
cout<<n<<endl;
}

int main() {
int n; cin >> n; cout << n << ": "; solve(n);
}


Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stdlib.h>
#define ll long long
#define MOD_P 1000000007
using namespace std;

struct vec {
	int to;
	int cost;
};

int main()
{
	int r, d;
	int len[11];
	cin >> r >> d >> len[0];
	
	for (int i = 1; i < 11; i++) {
		len[i] = r * len[i - 1] - d;
	}

	for (int i = 1; i < 11; i++) {
		printf("%d\n", len[i]);
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
	int n, a, b; cin >> n >> a >> b;
    cout << min(a, b) << " " << max(0, a + b - n) << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 892
// Problem : B - Homework
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define long long int;
const int MOD = 1e9 + 7;



int32_t main() {
	int lim, tasks; cin >> lim >> tasks;
	int sum = 0; for (int _ = 0, buff; _ < tasks; ++ _) cin >> buff, sum += buff;
	if (lim < sum) cout << -1;
	else cout << lim - sum << "\n";
}

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

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;
}

void bubble_sort (int array[], int array_size) {
  int i, j;

  for (i = 0; i < array_size - 1; i++){
    for (j = array_size - 1; j >= i + 1; j--){
      if (array[j] < array[j-1]) { swap(&array[j], &array[j-1]); }
    }
  }
}

int main(){

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

    bubble_sort(a,n);

    int tmp, j;
    long int answer = INFINITY;
    for(i = a[0]; i <= a[n-1] ; i++){
        tmp = 0;
        for(j = 0; j < n; j++){
            tmp += pow(a[j]-i,2);
        }

        if(tmp <= answer){
            answer = tmp;      
        }
    }
    printf("%ld",answer);
   return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(void){
int n,m,a,aa,A[100][100],b[100],sum=0;
scanf("%d %d",&n,&m);
for(a=0;a<n;a++)for(aa=0;aa<m;aa++)scanf("%d ",&A[a][aa]);
for(a=0;a<m;a++)scanf("%d",&b[a]);
for(a=0;a<n;a++){
for(aa=0;aa<m;aa++){
sum+=A[a][aa]*b[aa];
}
printf("%d\n",sum);
sum=0;
}

return 0;
}


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

#define V vector
typedef long long ll;
typedef unsigned long long ull;

typedef V<int> vi;
typedef V<ll> vll;
typedef V<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define f(i,a) for(int i = 0 ; i < a ; i++)
#define fll(i,a) for(ll i = 1 ; i <= a ;i++)
#define forab(i,a,b) for(int i = a ; i < b ; i++)
#define prec(x) cout<<fixed<<setprecision(x)
#define ff first
#define ss second
#define INF 1000000000

#define pb push_back
#define mp make_pair
#define numberofdigits(x) floor(log10(x)) + 1

long long binpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}

const int maxn = 1e7 + 1;

vll d(maxn);

void solve()
{

  ll n;
  cin >> n;

  ll sum = 0;

  for (ll i = 1 ; i <= n ; i++)
  {
    for (ll j = 1 ; j * i <= n ; j++)
      d[i * j]++;

    sum += d[i] * i;
  }

  cout << sum << "\n";

}



int main() {

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

  int t = 1;
  //cin >> t;

  while (t--)
  {
    solve();
  }
  return 0;
}

Measured memory_bytes: 81288
//by yjz
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
int W,H,n;
int L;
pair<int,int> p[300111];
int q[300111];
int qb,qe;
void clear()
{
	qb=qe=0;
}
void push(int pos,int v)
{
	while(qb<qe&&v>=q[qe-1])
	{
		qe-=2;
	}
	q[qe++]=pos;
	q[qe++]=v;
}
void pop(int pos)
{
	while(qb<qe&&q[qb]==pos)
	{
		qb+=2;
	}
}
int querymax()
{
	if(qb==qe)return -233333333;
	return q[qb+1];
}
int solve(int l,int r)
{
	if(l>=r)return 0;
	int mid=l+r>>1;
	int xL,xR;
	xL=l==0?0:p[l-1].FF;
	xR=r==n?W:p[r].FF;
//	cerr<<"solve:"<<l<<","<<r<<" "<<mid<<" "<<xL<<","<<xR<<endl;
	//solve 
	static int wid[300111];
	static int Low[300111],High[300111];
	Low[mid]=L;High[mid]=H-L;
	wid[mid]=0;
	for(int i=mid+1;i<r;i++)wid[i]=p[i].FF-p[mid].FF;
	wid[r]=xR-p[mid].FF;
	for(int i=mid-1;i>=l;i--)wid[i]=p[mid].FF-p[i].FF;
	wid[l-1]=p[mid].FF-xL;
	
	for(int i=mid;i<r;i++)
	{
		Low[i+1]=Low[i];High[i+1]=High[i];
		if(p[i].SS<=L)Low[i+1]=min(Low[i+1],L-p[i].SS);
		else High[i+1]=min(High[i+1],p[i].SS-L);
	}
	for(int i=mid;i>=l;i--)
	{
		Low[i-1]=Low[i];High[i-1]=High[i];
		if(p[i].SS<=L)Low[i-1]=min(Low[i-1],L-p[i].SS);
		else High[i-1]=min(High[i-1],p[i].SS-L);
	}
/*	for(int i=l-1;i<=r;i++)cerr<<Low[i]<<","<<High[i]<<" ";
	cerr<<endl;
	for(int i=l-1;i<=r;i++)cerr<<wid[i]<<" ";
	cerr<<endl;
	*/
	int ret=0;
	int itL=r,itH=r,MX=-233333333;
	clear();
	for(int i=l-1;i<mid;i++)
	{
		int L0=Low[i],H0=High[i];
		while(itL>mid&&Low[itL]<L0)
		{
			if(itL>itH)MX=max(MX,Low[itL]+High[itL]+wid[itL]),pop(-itL);
			else push(-itL,Low[itL]+wid[itL]);
			itL--;
		}
		while(itH>mid&&High[itH]<H0)
		{
			if(itH>itL)MX=max(MX,Low[itH]+High[itH]+wid[itH]),pop(-itH);
			else push(-itH,High[itH]+wid[itH]);
			itH--;
		}
		if(min(itL,itH)>mid)ret=max(ret,(L0+H0+wid[min(itL,itH)]+wid[i])*2);
		if(itL<itH)ret=max(ret,(querymax()+H0+wid[i])*2);
		if(itH<itL)ret=max(ret,(querymax()+L0+wid[i])*2);
		ret=max(ret,(MX+wid[i])*2);
	}
	ret=max(ret,solve(l,mid));
	ret=max(ret,solve(mid+1,r));
	return ret;
}
int solve()
{
	sort(p,p+n);
	int ret=0;
	for(int i=0;i<=n;i++)
	{
		int cur,pre;
		cur=i<n?p[i].FF:W;
		pre=i==0?0:p[i-1].FF;
		ret=max(ret,(cur-pre+H)*2);
	}
	L=H/2;
	int solve_ans0=solve(0,n);
	ret=max(ret,solve_ans0);
	return ret;
}
int main()
{
//	freopen("paint.in","r",stdin);
//	freopen("paint.out","w",stdout);
	scanf("%d%d%d",&W,&H,&n);
	for(int i=0;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		p[i]=MP(x,y);
	}
	int ans0=solve();
	swap(W,H);
	for(int i=0;i<n;i++)
	{
		swap(p[i].FF,p[i].SS);
	}
	int ans1=solve();
	cout<<max(ans0,ans1)<<endl;
//	cerr<<max(ans0,ans1)<<endl;
	return 0;
}

Measured memory_bytes: 7296
def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト

    answer = 0
    a.sort(reverse=True)

    for i in range(1, 2*N,2):
        answer += a[i]


    print(answer)

if __name__ == '__main__':
    main()


Measured memory_bytes: 37084
package main

import (
	"fmt"
)

func Prime(num int) bool {
	if num < 2 {
		return false
	} else if num == 2 {
		return true
	}
	if num%2 == 0 {
		return false
	}
	for i := 3; i*i <= num; i += 2 {
		if num%i == 0 {
			return false
		}
	}
	return true
}
func main() {
	var v, n int
	var count int = 0

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&v)

		if Prime(v) == true {
			count++
		}
	}
	fmt.Println(count)
}



Measured memory_bytes: 1680
S=input()
T=input()
l_S=len(S)
l_T=len(T)

def matchStr(S, T, l):
  f=False
  for i in range(l):
    if S[i] != "?" and S[i] != T[i]:
      f=True
      break
  if f:
    return False
  else:
    return True

f=False
for i in range((l_S-l_T+1)-1, -1, -1): #後ろから走らないといけない（辞書式だから）
  # print(S[i:i+l_T])
  if matchStr(S[i:i+l_T], T, l_T):
    S=list(S)
    T=list(T)
    S[i:i+l_T] = T
    f=True
    break

if f:
  for i in range(l_S):
    if S[i]=="?":
      S[i] = "a"
  S="".join(S) # リストから文字列に変換
  print(S)
else:
  print("UNRESTORABLE")


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const int N=512;
int B[N][N];

void solve(int d){
	auto go=[&](int i0,int j0,int color){
		for(int i=i0;i<2*N;i+=d){
			for(int j=j0-((i-i0)/d%2==0?0:d);j<N;j+=2*d){
				int y0=i,x0=j+d/2-1;
				for(int dy=-d/2+1;dy<=d/2-1;dy++){
					for(int dx=-d/2+1;dx<=d/2-1;dx++){
						int y=y0+dy,x=x0+dx;
						if(0<=y && y<N && 0<=x && x<N && (i+j)%2==(y+x)%2 && abs(y-y0)+abs(x-x0)<d/2){
							B[y][x]=color;
						}
					}
				}
			}
		}
	};

	go( 0 ,  0 ,0);
	go( 0 ,  d ,1);
	go(d/2,-d/2,2);
	go(d/2, d/2,3);

	rep(i,N) for(int j=1;j<N;j++) if((i+j)%2==1) B[i][j]=B[i][j-1];
}

int main(){
	int h,w,d; scanf("%d%d%d",&h,&w,&d);

	if(d%2==1){
		rep(i,N) rep(j,N) B[i][j]=(i+j)%2;
	}
	else{
		solve(d);
	}

	rep(i,h){
		rep(j,w) putchar("RGBY"[B[i][j+1]]);
		puts("");
	}



	return 0;
}


Measured memory_bytes: 4768
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

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

	vector<int> x(1, 1);
	for(int i=1; i<K; i++){
		int k = 0;
		while(k<x.size()-1 && (x[k]==x[k+1]+1 || x[k]==9)) k++;
		if(x[k]==9){
			x.push_back(1);
			x[k] = 0;
		} else {
			x[k]++;
		}

		for(int j=k-1; j>=0; j--) x[j]=max(0, x[j+1]-1);

		/*
		for(int i=x.size()-1; i>=0; i--) cout << x[i];
		cout << endl;
		*/
	}
	for(int i=x.size()-1; i>=0; i--) cout << x[i];
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int h, w;
    while (1) {
        cin >> h >> w;
        if (h==0 && w==0) break;
        for (int i=0; i<h; i++) {
            if (i%2 != 0){
                for (int j=0; j<w; j++) {
                    if (j%2 != 0) {
                        cout << "#";
                    } else {
                        cout << ".";
                    }
                }
                cout << endl;
            } else {
                for (int k=0; k<w; k++) {
                    if (k%2 != 0) {
                        cout << ".";
                    } else {
                        cout << "#";
                    }
                }
                cout << endl;
            }
        }
        cout << endl;
    }
    return 0;
}


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

int main() {
  
  int N, H;
  cin >> N;
  
  int now=0;
  int counter=0;
  int M=0;
  
  for ( int i=0; i < N; i++) {
    
    cin >> H;
    
    if ( now >= H ) {
      
      counter++;
      now= H;
      
      if ( M < counter) {
         M = counter;
      }
    }
    
    if ( now < H ) {
      
      counter=0;
      now=H;
    }
  }
  
  cout << M << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1e9)
using namespace std;
struct data{int y,x;};
int n;
data stmp[16];
bool can[16][16];
string mp[16];
char RGB[3]={'R','G','B'};

int Idx(int y,int x){return y*4+x;}
int getBit(int sta,data a,data b,char ch){
  int res=0;
  for(int i=0;i<4;i++)
    for(int j=0;j<4;j++){
      if(a.x<=j&&j<=b.x&&a.y<=i&&i<=b.y)res|=(mp[i][j]==ch)<<Idx(i,j);
      else res|=(sta&(1<<Idx(i,j)));
    }
  return res;
}


int bfs(){
  vector<int>D(1<<16,INF);
  queue<int> Q;
  Q.push(0);
  D[0]=0;
  while(!Q.empty()){
    int bit=Q.front();Q.pop();
    if(bit==(1<<16)-1)break;
    for(int i=0;i<3;i++)
      for(int a=0;a<16;a++)
	for(int b=0;b<16;b++)
	  if(can[a][b]){
	    data yx=(data){a/4,a%4};
	    data YX=(data){b/4,b%4};
	    int nbit=getBit(bit,yx,YX,RGB[i]);
	    if(D[nbit]==INF)Q.push(nbit),D[nbit]=D[bit]+1;
	  }
  }
  return D[(1<<16)-1];
}

void mk_can(){
  for(int i=0;i<n;i++){
    int w=stmp[i].x,h=stmp[i].y;
    for(int y=-3;y<4;y++)
      for(int x=-3;x<4;x++){
	int a=max(0,y),b=max(0,x);
	int Y=min(3,y+h-1);
	int X=min(3,x+w-1);
	if(a>Y||b>X)continue;
	can[Idx(a,b)][Idx(Y,X)]=1;
      }
  }
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++) cin>>stmp[i].y>>stmp[i].x;
  for(int i=0;i<4;i++)cin>>mp[i];
  mk_can();
  cout<<bfs()<<endl;
  return 0;
}

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

a_i_list = list(map(int, input().split(" ")))

a_i_list_sorted = sorted(a_i_list, reverse=True)

alice_sum = 0
bob_sum = 0

for index, val in enumerate(a_i_list_sorted):
  if index % 2 == 0:
    alice_sum += val
  else:
    bob_sum += val

print(alice_sum - bob_sum)

Measured memory_bytes: 3060
input_list = list(map(int, input().split()))
for i in range(len(input_list)):
  strang = 0
  for j in input_list:
    if input_list[i] == j:
      strang += 1
  if strang == len(input_list):
    print("No")
    break
  if strang == len(input_list) - 1:
    print("Yes")
    break
if strang == 1:
  print("No")
    

Measured memory_bytes: 2940
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		String tmp = "";
		String SW = "";
		List<String> a = new ArrayList<String>();

		for (int i = 0; i < H; i++) {
			a.add(sc.next());
		}

		//横方向探索

		for (int i = 0; i < W; i++) {
			tmp += ".";
		}
		for (int i = 0; i < H; i++) {
			if (a.get(i).equals(tmp)) {
				a.remove(i);
				H--;
				i--;
			}
		}

		//縦方向探索
		tmp = "";
		for (int i = 0; i < H; i++) {
			tmp += ".";
		}

		for (int j = 0; j < W; j++) {
			SW = "";
			for (int i = 0; i < H; i++) {
				SW += a.get(i).substring(j, j + 1);
			}
			if (tmp.equals(SW)) {
				for (int i = 0; i < H; i++) {
					a.set(i, a.get(i).substring(0, j) + a.get(i).substring(j + 1, W));
				}
				W--;
				j--;
			}
		}

		//出力
		for (int i = 0; i < H; i++) {
			System.out.println(a.get(i));
		}

		sc.close();
	}

}


Measured memory_bytes: 29652
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

typedef valarray<ld> Point;

const ld eps = 1e-8, inf = 1e12;

Point make_point(ld x, ld y, ld z) {
	Point p(3);
	p[0] = x; p[1] = y; p[2] = z;
	return p;
}

ld dot(const Point &a, const Point &b) {
	return (a * b).sum();
}

Point cross(const Point &a, const Point &b) {
	return a.cshift(+1) * b.cshift(-1) - a.cshift(-1) * b.cshift(+1);
}

ld norm(const Point &a) { return dot(a, a); }
ld dist(const Point &a) { return sqrt(norm(a)); }

// Line

struct Line { Point a, b; };

bool is_in_segment(Line l, Point p) {
	return abs(dist(l.a - p) + dist(l.b - p) - dist(l.a - l.b)) < eps;
}

Point project_lp(Line l, Point p) {
	Point point = l.a, vec = l.b - l.a;
	return point + dot(p - point, vec) / norm(vec) * vec;
}

ld distance_lp(Line l, Point p) {
	return dist(p - project_lp(l, p));
}

ld distance_sp(Line l, Point p) {
	Point proj = project_lp(l, p);
	if (dist(l.a - proj) + dist(l.b - proj) < dist(l.b - l.a) + eps)
		return dist(p - proj);
	else
		return min(dist(p - l.a), dist(p - l.b));
}

struct light
{
	Point p;
	ld br;
};

struct balloon
{
	Point p;
	ld r;
};

int main()
{
	int n, m, r;
	while (cin >> n >> m >> r, n)
	{
		vector<balloon> vb(n);
		vector<light> vl(m);
		REP(i, n)
		{
			ld x, y, z, r;
			cin >> x >> y >> z >> r;
			vb[i] = balloon{ Point{x,y,z}, r };
		}
		REP(i, m)
		{
			ld x, y, z, r;
			cin >> x >> y >> z >> r;
			vl[i] = light{ Point{ x,y,z }, r };
		}
		ld x, y, z;
		cin >> x >> y >> z;
		Point p{ x,y,z };
		vector<vi> obst(m);
		REP(i, m)REP(j, n)
		{
			ld d = distance_sp(Line{ vl[i].p, p }, vb[j].p);
			if ((vb[j].r - dist(vb[j].p - vl[i].p) > -EPS && vb[j].r - dist(vb[j].p - p) > -EPS)) continue;
			if (vb[j].r - d > EPS)
			{
				obst[i].push_back(j);
			}
		}
		vector<ld> bright(m);
		REP(i, m)
		{
			ld d = norm(p - vl[i].p);
			bright[i] = vl[i].br / d;
		}
		ld ans = 0;
		REP(i, 1 << m)
		{
			vector<bool> rem(n);
			ld tmp = 0;
			REP(j, m)
			{
				if ((i >> j) & 1) continue;
				tmp += bright[j];
				REP(k, obst[j].size()) rem[obst[j][k]] = true;
			}
			if (count(ALL(rem), true) > r) continue;
			chmax(ans, tmp);
		}
		cout << D10 << ans << endl;
	}
	return 0;
}

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

int main() {

    int K,A,B;
    cin>>K>>A>>B;

    if(A%K==0||B%K==0){

        cout<<"OK"<<endl;
    }

    else if (A/K!=B/K){

        cout<<"OK"<<endl;
    }

    else{

        cout<<"NG"<<endl;
    }
    
    }

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

using namespace std;

#define fio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define double long double
#define endl '\n'

signed main() {
   fio;
   int x; cin >> x;
   if(x >= 30) {
      cout << "Yes" << endl;
   } else {
      cout << "No" << endl;
   }

   
   return 0;
}




Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#define a(i,b) for(int i=0;i<b;i++)
using namespace std;
int main() {
    int n,c;
    while(scanf("%d",&n)!=EOF){
    	c=0;
    	a(i,10)a(j,10)a(k,10)a(h,10)if(i+j+k+h==n)c++;
    cout<<c<<endl;
    }
    return 0;
}

Measured memory_bytes: 1208
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        var n = long.Parse(Console.ReadLine());
        char[] s = Console.ReadLine().ToCharArray();

        var ans = long.MaxValue;

        long[] b = new long[n];
        long[] w = new long[n];
        if (s[0] == '.') w[0] = 1;
        if (s[0] == '#') b[0] = 1;
        for (int i = 1; i < n; i++)
        {
            if (s[i] == '.') w[i] = w[i - 1] + 1;
            else w[i] = w[i - 1];

            if (s[i] == '#') b[i] = b[i - 1] + 1;
            else b[i] = b[i - 1];
        }

        //ans = Math.Min(ans, w[n - 1]);
        //ans = Math.Min(ans, b[n - 1]);
        for (int i = 0; i < n; i++)
        {
            long a = 0;
            long c = 0;
            if(i != n - 1) a = (b[n - i - 1]);
            if(i != 0) c = (w[n - 1] - w[n - i - 1]);
            ans = Math.Min(ans, a + c);
        }


        // 出力
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 31668
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

def solve():
    N, Y = mapint()
    for i in range(N+1):
        for j in range(N-i+1):
            now = i*10000 + j*5000
            if now>Y:
                continue
            if i+j+(Y-now)//1000==N:
                return (i, j, N-i-j)
    else:
        return (-1, -1, -1)

print(*solve())

Measured memory_bytes: 65484
#include<iostream>
using namespace std;
int main(){
	int a, b, c, x[20][20], y[20], z[20] = { 0 },p=0;
	cin >> a >> b >> c;
	for (int i = 0; i < b; i++) {
		cin >> y[i];
	}
	for (int j = 0; j < a; j++) {
		for (int i = 0; i < b; i++) {
			cin >> x[j][i];
			z[j] += x[j][i] * y[i];
		}
		if (z[j]+c > 0)p++;
	}
	cout << p << endl;
	return 0;

}

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

using namespace std;

string splus(string in, int p){
  if(p < 10) in += p+'0';
  else{
    vector <char> V;
    while(p){
      V.push_back((p%10)+'0');
      p/=10;
    }
    reverse(V.begin(),V.end());
    for(int i = 0; i < V.size(); i++) in += V[i];
  }
  return in;
}

string change(string in){
  string out = "";
  char now = in[0];
  int sum = 0;
  for(int i = 0; i <= in.length(); i++){
    if(in[i] == now){
      sum++;
      if(i == in.length()){
	out = splus(out,sum);
	out+= now;
      }
    }else{
      out = splus(out,sum);
      out += now;
      now = in[i];
      sum = 1;
    }
  }
  // cout << out << endl;
  return out;
}
int main(){
  int in;
  while(cin >> in && in){
    string str;
    cin >> str;
    for(int i = 0; i < in; i++) str = change(str);
    cout << str << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
// AtCoder agc002

#include <bits/stdc++.h>
#define ld long double
#define ll long long int
#define mod 1000000007
#define ll_inf 1000000000000000
#define int_inf 1000000000
#define pb push_back
#define endl '\n'
#define Endl '\n'
#define eps 1e-9
#define PI acos(-1.0)
#define ii pair<int,int>
#define iii pair<int,ii>
#define se second
#define fi first
using namespace std;

int main(){
    //cout.precision(12);
    //ifstream fin("in");
    ll a,b;
    cin>>a>>b;
    if(a<=0 && b>=0)cout<<"Zero"<<endl;
    else if(a>0)cout<<"Positive"<<endl;
    //else if(a<0 && a==b)cout<<"Positive"<<endl;
    else if(a<0 && b<0 && (b-a+1)%2==0)cout<<"Positive"<<endl;
    else if(a<0 && b<0 && (b-a+1)%2==1)cout<<"Negative"<<endl;
    else if(a<0 && b>0 && (-a)%2==0)cout<<"Positive"<<endl;
    else cout<<"Negative"<<endl;
}


Measured memory_bytes: 256