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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

    string s;
    cin>>s;
    set<char> se;
    rep(i,s.size()){
        se.insert(s[i]);
    }
    if(s.size()==se.size()) cout << "yes" << endl;
    else cout << "no" << endl;
    
    return 0;
}


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

int main() {
  long int n,m,LCM,gcd;
  string s,t;
  cin>>n>>m>>s>>t;
  gcd=__gcd(n,m);
  LCM=n*m/gcd;
  
  for(long int i=0;i<gcd;i++){
    if(s.at(i*n/gcd)!=t.at(i*m/gcd)){
      cout<<-1<<endl;
      return 0;
    }
  }
  cout<<LCM<<endl;
}

Measured memory_bytes: 512
// ABC179B - 

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;

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

	int D1[N], D2[N];
	for (int i = 0; i < N; i++) {
		cin >> D1[i] >> D2[i];
	}

	for (int i = 0; i < N - 2; i++) {
		if ((D1[i]   == D2[i])
		  &&(D1[i+1] == D2[i+1])
		  &&(D1[i+2] == D2[i+2])) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
int a,s,d[1000][1000],f,g,h,i,j;
int main(void)
{
	scanf("%d %d",&a,&s);
	for(i=0;i<a;i++){
		for(j=0;j<s;j++)
			scanf("%d",&d[i][j]);
	}
	for(i=0;i<a;i++){
		for(j=0;j<s;j++)
			d[i][s]+=d[i][j];
			d[a][s]+=d[i][j];
	}
	for(i=0;i<s;i++){
		for(j=0;j<a;j++)
			d[a][i]+=d[j][i];	
	}
	for(i=0;i<=a;i++){
		for(j=0;j<=s;j++){
			printf("%d",d[i][j]);
			if(s!=j){
				printf(" ");
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 3012
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

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

void solve() {
    int n,k;
    cin >> n >> k;
    VLL a(n);
    REP(i,0,n) cin >> a[i];
    VLL ru(n+1);
    REP(i,0,n) ru[i+1] = ru[i] + a[i];
    LL ans = 0;
    RREP(m,0,40) {
        int cnt = 0;
        REP(i,0,n) REP(j,i+1,n+1) {
            LL sum = ru[j] - ru[i];
            if ((sum & ans) < ans) continue;
            if (sum & (((LL)1) << m)) ++cnt;
        }
        if (cnt >= k) ans |= (((LL)1) << m);
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

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

int main()
{
	int a, b, k;
	cin >> a >> b >> k;
	int maxDiv = min(a, b);
	
	int cnt = 0;
	for (int i = maxDiv; i > 0; --i) {
		if (a % i == 0 && b % i == 0) {
			++cnt;
			if (cnt == k) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
a,b,c = map(int,input().split())


ans = 0
while True:
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        print(ans)
        import sys
        sys.exit()
    if a == b and b== c:
        print(-1)
        import sys
        sys.exit()
    ans += 1
    a,b,c = b // 2 + c // 2, a // 2 + c // 2,a // 2 + b // 2



Measured memory_bytes: 2940
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int ll
#define vi vector<int>
#define vb vector<bool>
#define vvb vector<vb >
#define pii pair<int,int>
#define ss second
#define ff first
#define vpii vector<pii>
#define vvi vector<vi >
#define vs vector<string>
#define vvs vector<vs >
#define pqi priority_queue <int>
#define minpqi priority_queue <int, vector<int>, greater<int> >
#define all(x) x.begin(),x.end()
#define mii map<int,int>
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define per1(i,n) for(ll i=n;i>0;i--)
#define repeat(i,start,n) for(ll i=start;i<n;i++)
#define inp(arr,n) ll arr[n];rep(i,n){ cin>>arr[i];}
#define inp1(arr,n) ll arr[n+1];rep1(i,n){ cin>>arr[i];}
#define inp2d(arr,n,m) ll arr[n][m];rep(i,n)rep(j,m)cin>>arr[i][j];
#define inpg(adj,m) rep(i,m){int a,b;cin>>a>>b;adj[a].pb(b);adj[b].pb(a);}
#define print(a,n) for(ll i=0;i<n;i++){ cout<<a[i]<<" ";}
#define print1(a,n) for(ll i=1;i<=n;i++){ cout<<a[i]<<endl;}
#define mod 1000000007
#define maxx 1000000000000000000
#define PI 3.141592653589793238462643383279
#define mmax(a,b,c) max(a,max(b,c))
#define mmin(a,b,c) min(a,min(b,c))
#define init(arr,a) memset(arr,a,sizeof(arr))
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element

/*freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);*/
//------------------------------------Code Starts here------------------------------------//

void solve()
{

}
main()
{
	int n;
	cin>>n;
	int a[n];
	for0(i,n)cin>>a[i];
	 int pre[n+1];
	pre[0]=0;
	for1(i,n)
	{
		a[i-1]%=mod;
		pre[i]=(pre[i-1]%mod+a[i-1]%mod)%mod;
		pre[i]%=mod;
	}
	 int sum=0;
	for0(i,n)
	{
		sum=(sum%mod+((a[i]%mod)*((pre[n]-pre[i+1]+mod)%mod))%mod)%mod;
		sum%=mod;
	}
	cout<<sum%mod;
}


Measured memory_bytes: 6716
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmax(T& a,U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a,U b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1e18;

int main() {
    int n, w;
    long long min_w = INF, ans = 0;
    cin >> n >> w;
    vector<long long> val(n), wei(n);
    vector<vector<long long>> data(4), sum(4);
    for (int i = 0; i < n; i++) {
        cin >> wei[i] >> val[i];
        chmin(min_w, wei[i]);
    }
    for (int i = 0; i < n; i++) {
        int id = abs(wei[i] - min_w);
        data[id].emplace_back(val[i]);
    }
    
    for (int i = 0; i < 4; i++) {
        sum[i].assign((int)data[i].size()+1, 0);
        sort(data[i].rbegin(), data[i].rend());
        for (int j = 0; j < (int)data[i].size(); j++) {
            sum[i][j+1] = sum[i][j] + data[i][j];
        }
    }
    
    for (int w0 = 0; w0 < sum[0].size(); w0++) {
        for (int w1 = 0; w1 < sum[1].size(); w1++) {
            for (int w2 = 0; w2 < sum[2].size(); w2++) {
                for (int w3 = 0; w3 < sum[3].size(); w3++) {
                    long long sum_w = w0*min_w+w1*(min_w+1)+w2*(min_w+2)+w3*(min_w+3);
                    long long sum_v = sum[0][w0]+sum[1][w1]+sum[2][w2]+sum[3][w3];
                    if (sum_w <= w) chmax(ans, sum_v);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int A[100];
int main()
{
  int N,K;
  cin>>N>>K;
  for(int i=0;i<N;i++)
    cin>>A[i];
  int Ans=0;
  for(int i=0;i<=N;i++)
    for(int j=i;j<=N;j++)
      if(i+N-j<=K)
      {
        int Sum=0;
        vector<int> V;
        int k=K-(i+N-j);
        for(int l=0;l<i;l++)
          V.push_back(A[l]);
        for(int l=j;l<N;l++)
          V.push_back(A[l]);
        sort(V.begin(),V.end());
        for(int l=0;l<V.size();l++)
          Sum+=V[l];
        for(int l=0;l<min(k,(int)(V.size()))&&V[l]<0;l++)
          Sum-=V[l];
        Ans=max(Ans,Sum);
      }
  cout<<Ans<<endl;
  return 0;
}

Measured memory_bytes: 256
from itertools import *
s = input()

n = len(s) - 1 # 隙間の数
plus_list = list(product(["+", ""], repeat=n))

ans = 0

for bit in range(1 << n):
    formula = s[0]
    for j, k in zip(plus_list[bit], s[1:]):
        formula += (j + k)
    ans += eval(formula)

print(ans)


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using ll = long long;
using ull = unsigned long long;


int main(void)
{
    IOS
    int n,m; cin >> n >> m;
    vector<set<int>> vs(n+1);
    REP(i,m) {
        int u,v; cin >> u >>v;
        vs[u].emplace(v);
    }
    int s,t; cin >> s >> t;

    int dp[3][100010];
    REP(i,3) REP(j,100010) dp[i][j] = 0;
    dp[0][s] = 1;

    set<int> next(vs[s]);

    int ans = 1;
    while(true) {
        FOR(i,0,3) {
            set<int> tmp;
            //cerr << next.size() << endl;
            int j = i == 2 ? 0:i+1;
            for(auto x:next) {
                if (dp[j][x]!=1) {
                    dp[j][x] = 1;
                    tmp.insert(ALL(vs[x]));
                }
            }
            next = tmp;
        }
        if (dp[0][t]== 1) break;
        //cerr << next.size()<<endl;
        if (next.size() == 0) {
            ans = -1;
            break;
        }
        ans++;
    }

    cout << ans << endl;

    return 0;
}


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

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    int f = n/100;
    n = n-(n/100)*100;
    n = n- (n/10)*10;
    if(f==n){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <iomanip>



int main()
{
	long long  n;

	std::cin >> n;

	std::vector<long long> v(100003);
	
	for (int i = 0; i < n; i++) {
		int a;
		std::cin >> a;
		v[a]++;
	}
	
	long long count = v[0] + v[1];

	for (int i = 1; i < v.size() - 2; i++) {
		count = std::max(count, v[i - 1] + v[i] + v[i + 1]);
	}

	std::cout << count << std::endl;

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int len1,len2;
const int lmt=4000;
int store[lmt][lmt];
string s,t;
string ans;
int dp(int i,int j)
{
    if(store[i][j]!=-1) return store[i][j];
    if(s[i]=='\0' or t[j]=='\0') return 0;
    int ans=0;
    if(s[i]==t[j])
    {
        ans=1+dp(i+1,j+1);
    }
    else
    {
        int res1=dp(i+1,j);
        int res2=dp(i,j+1);
        ans=max(res1,res2);
    }
    store[i][j]=ans;
    return ans;
}
void printsolu(int i,int j)
{
    if(s[i]=='\0' or t[j]=='\0')
    {
        return ;
    }
    if(s[i]==t[j])
    {
        ans+=s[i];
        printsolu(i+1,j+1);
    }
    else
    {
        if(store[i+1][j]>store[i][j+1])
        {
            printsolu(i+1,j);
        }
        else
        {
            printsolu(i,j+1);
        }
    }
}
int main()
{
    //freopen("take.in","r",stdin);
    cin>>s>>t;
    len1=s.size(),len2=t.size();
    memset(store,-1,sizeof store);
    int u=dp(0,0);
    printsolu(0,0);
    cout<<ans<<endl;
}

Measured memory_bytes: 63104
#include <utility>
#include <iostream>
#include <cmath>
#include <deque>
#include <string>
#include <time.h>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <algorithm>
#include <bitset>

#define pii pair<ll,ll>
#define X first
#define Y second
#define mp make_pair

typedef long long ll;
using namespace std;
#define MAXN 10000007
#define MOD 998244353
#define N 1048576
ll n, x, k, z, m, pos, q, ans_v, y;
ll x1, p1, x2;
ll d[100500];
ll c[100500];
vector<ll> rem[100500];
vector<pii> g[100500];
multiset<ll> f;

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> x >> y >> z;
        g[x].push_back(mp(y, z));
    }
    d[1] = 0;
    for (int i = 2; i <= n; i++) {
        d[i] = (ll)1e+18;
    }
    for (int i = 1; i <= n; i++) {
        for (auto x : rem[i]) {
            f.erase(f.find(x));
        }
        if (i != 1) {
            if (f.empty()) {
                cout << -1 << endl;
                return 0;
            } else {
                d[i] = *(f.begin());
            }
        }
        for (auto p : g[i]) {
            rem[p.X + 1].push_back(d[i] + p.Y);
            f.insert(d[i] + p.Y);
        }
    }
    cout << d[n] << endl;

    return 0;
}

Measured memory_bytes: 13184
#include <stdio.h>
#include <stdlib.h>

struct Node{
  int key;
  struct Node *right,*left,*parent;
};

struct Node *root,*NIL;

void insert(int k){
  struct Node *y=NIL;
  struct Node *x=root;
  struct Node *z;

  z=(struct Node *)malloc(sizeof(struct Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->key<x->key) x=x->left;
    else x=x->right;
  }
    z->parent=y;
    if(y==NIL)root=z;
    else if(z->key<y->key) y->left=z;
    else y->right=z;
}

void inorder(struct Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct Node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char str[20];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",str);
    if(str[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }
    else if(str[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

Measured memory_bytes: 24040
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int a, b; cin >> a >> b;
  auto ans = (a+b) % 3 == 0 || a % 3 == 0 || b % 3 == 0;
  cout << (ans ? "Possible" : "Impossible") << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
from sys import stdin

X = [ 0 for i in range(100) ]
G = [[ 0 for i in range(100) ] for i in range(100)]

n = int(input())
for i in range(n) :
	X[i] = stdin.readline().strip().split()


for i in range(n) :
	for j in range(int(X[i][1])) :
		G[i][int(X[i][j+2])-1] = 1

for i in range(n) :
	for j in range(n) :
		if j != n-1 : print(G[i][j],end=" ")
		else : print(G[i][j])

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

int main(){
	int n, m;
	int A[100][100];
	int b[100];
	int c[100];
	int i, j;
	
	scanf("%d %d", &n, &m);
	
	for(i=0; i< n; i++){
		for(j=0; j<m; j++){
			scanf("%d", &A[i][j]);
		}
	}
	for(j=0; j<m; j++){
		scanf("%d", &b[j]);
	}	
	
	for(i=0; i< n; i++){
		for(j=0; j<m; j++){
			c[i] += A[i][j] * b[j];
		}
	}

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

}


Measured memory_bytes: 2100
using System;
using System.Collections;

namespace AOJ.intro
{
    namespace ITP_1_2_C
    {
        public static class SortingThreeNumbers
        {
            public static void Main(string[] args)
            {
                string[] threeNum = Console.ReadLine().Split();
                Array.Sort(threeNum);
                Console.WriteLine(threeNum[0] + " " + threeNum[1] + " " + threeNum[2]);
            }
        }
    }
}


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

#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

int N, M, Q;
vector<int> graph[100001];
vector<Pii> uv;
int d[100001];
map<Pii, int> inc;

void dij() {
  priority_queue<Pip, vector<Pip>, greater<Pip> > q;
  bool used[100001] = {0};
  q.push(Pip(0, Pii(-INF, 0)));
  while ( !q.empty() ) {
    Pip p = q.top(); q.pop();
    int c = p.fr, r = p.sc.fr, n = p.sc.sc;
    
    if ( used[n] ) continue;
    d[n] = -r;
    used[n] = true;

    Rep(i, graph[n].size()) {
      int ne = graph[n][i];
      if ( inc[Pii(n, ne)] ) {	
	q.push(Pip(c+1, Pii(max(r, -(inc[Pii(n, ne)]-1)), ne)));
      } else {
	q.push(Pip(c+1, Pii(r, ne)));
      }
    }
  }
}

signed main() {
  cin >> N >> M >> Q;
  Rep(i, M) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    uv.pb(Pii(u, v));
    graph[u].pb(v);
    graph[v].pb(u);
  }

  Rep(i, Q) {
    int R;
    cin >> R;
    R--;
    int u = uv[R].fr, v = uv[R].sc;
    inc[Pii(u, v)] = inc[Pii(v, u)] = i+1;
  }

  dij();
  int ans[200001] = {0};
  //Rep(i, N) cout << d[i] << endl;
  Rep(i, N) if ( d[i] != INF ) ans[d[i]]++;
  for ( int i = 1; i < Q; i++ ) ans[i] = ans[i] + ans[i-1];

  Rep(i, Q) cout << ans[i] << endl;

  return 0;
}

Measured memory_bytes: 49548
#include "bits/stdc++.h"
#include <chrono>
#include <random>
#include <cstdio>
#define ll long long int
#define endl '\n'
#define pb push_back
#define mp make_pair
// #define mod 998244353
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
const int N=500001;
// vector<pair<ll, ll> > adj[N];
// bool vis[N];
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
#define pi 3.14159265358979323846264338
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
ll inf = 100000000000000000;
vector <pint> adj[N];

void solve() 
{
    int x;
    cin>>x;

    if(x < 600)
    {
        cout<<8<<endl;
        return;
    }

    if(x < 800)
    {
        cout<<7<<endl;
        return;
    }
    if(x < 1000)
    {
        cout<<6<<endl;
        return;
    }
    if(x < 1200)
    {
        cout<<5<<endl;
        return;
    }
    if(x < 1400)
    {
        cout<<4<<endl;
        return;
    }
    if(x < 1600)
    {
        cout<<3<<endl;
        return;
    }
    if(x < 1800)
    {
        cout<<2<<endl;
        return;
    }

    cout<<1<<endl;

}

int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)

    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }

    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 15532
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cstdlib>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;

int n;
int search(int sum, int left, int right, vector<int> array) {
	int count = 0;
	int tmp = right;
	//cout << "right:" << right << " " << "left:" << left << endl;
	while(1) {
		//cout << "sum:" << sum << " " << "array[right]:" << array[right] << endl;
		//cout << right - left << endl;
		if(sum <= array[right]) {
			right--;
		}
		else {
			if(right-left == 1) {
				return 1;
			}
			else if(tmp == right) {
				return right - left;
			}
			else {
				//cout << "return:" << right -left -1 << endl;
				return right-left-1;
			}
		}
		if(right <= left) { 
			return 0;
		}
	}
}



int main() {
	cin >> n;
	vector<int> l(n, 0);
	for(int i = 0; i < n; i++) {
		cin >> l[i];
	}

	sort(l.begin(), l.end());
	int count = 0;
		
	int sum = 0;
	/*
	for(int i = 0; i < n-2; i++) {
		for(int j = i+1; j < n-1; j++) {
			sum = l[i]+l[j];
			count += search(sum, j, n-1, l);
		}
	}
	*/

	for(int i = 0; i < n-2; i++) {
		for(int j = i+1; j < n-1; j++) {
			for(int k = j+1; k < n; k++) {
				if(l[i]+l[j] > l[k]) {
					count++;
				}
				else {
					break;
				}
			}
		}
	}


	cout << count << endl;

	return 0;


	
}


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

using namespace std;


void solve() {
    int n,m, a,b;
    cin >> n >> m >> b >> a;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if ( (i < a && j < b) || (a<=i && b<=j) ) {
                cout << 0;
            }else cout << 1;
        }cout << "\n";
    }

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 1280
from math import ceil,floor

W,H = map(int,input().split())

def S(H,W):
	res = []
	for i in range(1,H):
		S1 = i*W
		S2 = (H-i)*ceil(W/2)
		S3 = (H-i)*floor(W/2)
		S4 = W*ceil((H-i)/2)
		S5 = W*floor((H-i)/2)
		res.append(max(S1,S2,S3)-min(S1,S2,S3))
		res.append(max(S1,S4,S5)-min(S1,S4,S5))
	return(min(res))

print(min(S(H,W),S(W,H)))

Measured memory_bytes: 11032
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> words = new ArrayList<>();
        for (int i = 0; i < n; i++) words.add(sc.next());

        Set<String> removed = new LinkedHashSet<>(words);
        if (words.size() != removed.size()) {
            System.out.println("No");
            return;
        }

        char end = words.get(0).charAt(words.get(0).length() - 1);
        for (int i = 1; i < n; i++) {
            char start = words.get(i).charAt(0);
            if (start != end) {
                System.out.println("No");
                return;
            }
            end = words.get(i).charAt(words.get(i).length() - 1);
        }
        System.out.println("Yes");
    }
}

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

int A[11];

int f(int k)
{
    int len = 0;
    for(;k;len++){A[len]=k%10; k/=10;}
    for(int i=0;i<=(len+1)/2;i++)
        if(A[i]!=A[len-1-i])return 0;
    return 1;
}
int main()
{
    int n,m,i,cnt=0;
    scanf("%d %d",&n,&m);
    for(i=n;i<=m;i++)cnt+=f(i);
    printf("%d",cnt);
    return 0;
}


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

int SelectionSort(vector<int>& v) {
    int mini;
    int counter = 0;
    for (int i = 0; i < v.size(); ++i) {
        mini = i;
        for (int j = i + 1; j < v.size(); ++j) {
            if (v[j] < v[mini]) {
                mini = j;
            }
        }
        if (i != mini) {
            v[i] = v[i] ^ v[mini];
            v[mini] = v[i] ^ v[mini];
            v[i] = v[i] ^ v[mini];

            counter++;
        }
    }

    return counter;
}

int main() {
    int N, tmp, counter;
    vector<int> v;
    cin >> N;

    for (int i = 0; i < N; ++i) {
        cin >> tmp;
        v.push_back(tmp);
    }
    counter = SelectionSort(v);
    for (int i = 0; i < v.size(); ++i) {
        if (i + 1 != v.size())
            cout << v[i] << " ";
        else
            cout << v[i] << endl;
    }
    cout << counter << endl;
}



Measured memory_bytes: 3132
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n,y=LI()
  for i in range(n+1):
    for j in range(n+1-i):
      if 10000*i+5000*j+1000*(n-i-j)==y:
        print(i,j,n-i-j)
        exit()
  print(-1,-1,-1)

main()


Measured memory_bytes: 7624
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();

		Calc res = new Calc(n);
		System.out.println( res.toString() );
	}
	public static class Calc {
		int inN;
		int inY;
		
		int out = -1;

		public Calc(int x) {
			int v1000 = x / 500;
			int v5 = (x%500) /5;
			
			out = 1000* v1000 + v5 * 5;
		}

		@Override
		public String toString() {
			return ""+ out;
		}
		
		

	}
	
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

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

    std::string S;
    std::cin >> S;

    int res = 4000;
    for(int i=0;i+3<=S.size();++i){
        res = std::min(res, std::abs(753 - std::stoi(S.substr(i, 3))));
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	string ans;
	int c=0;

	for(int i=0;i<s.length()-2;i++)
	{
		
		for(int j=i;j<i+3;j++)
		{
			ans+=s[j];
		}
		// cout<<"ans"<<" "<<ans<<endl;
		if(ans=="ABC")
		{
			c++;
		}
		ans="";
	}
	cout<<c<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int main()
{
    int n1;
    cin>>n1;
    int h[n1], hm[n1];
    int minh;
    for (int i = 0; i<n1;i++) {
        cin>>h[i];
    }
    
    for (int i = 0; i<n1-1;i++) {
        if(i==0)
        {
            hm[i+1]=abs(h[i]-h[i+1]);
            hm[i+2]=abs(h[i]-h[i+2]);
            minh=min(hm[i+1], hm[i+2]);
        }
        else if(i==n1-2)
        {
            hm[i+1]=min(abs(h[i]-h[i+1])+hm[i], hm[i+1]);
            minh=hm[i+1];
        }
        else
        {
            hm[i+1]=min(abs(h[i]-h[i+1])+hm[i], hm[i+1]);
            hm[i+2]=abs(h[i]-h[i+2])+hm[i];
            minh=min(hm[i+1], hm[i+2]);
        }
    }
    
    cout << minh;
    return 0;

}


Measured memory_bytes: 1024
A, B = map(int, input().split())
count = 0
for i in range(16):
  if count == 0:
    A -= 1
    count += 1
  else:
    count -= 1
    B -= 1
if A <= 0 and B <= 0:
	print('Yay!')
else:
  print(':(')

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

vector<ll> Y[100005];
//! 同じmodのなかで同じ整数ペアの数
ll P[100005];
ll S[100005];

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> v;
    REP(i, N)
    {
        ll x;
        cin >> x;
        Y[x % M].push_back(x);
        if (Y[x % M].size() == 1)
            v.push_back(x % M);
    }

    memset(P, 0, sizeof(P));
    memset(S, 0, sizeof(S));
    REP(i, v.size())
    {
        sort(Y[v[i]].begin(), Y[v[i]].end());
        ll p = 0;
        FOR(j, Y[v[i]].size(), 1)
        {
            if (Y[v[i]][j - 1] == Y[v[i]][j])
            {
                p++;
                j++;
            }
        }
        S[v[i]] = Y[v[i]].size();
        P[v[i]] = p;
    }

    ll ans = 0;
    REP(i, v.size())
    {
        //! 先に足してMの倍数になるのかぞえる
        ll n = std::min(S[v[i]], S[(M - v[i]) % M]);
        if (v[i] == 0 || v[i] == M / 2)
            n /= 2;
        ans += n;
        S[v[i]] -= n;
        S[(M - v[i]) % M] -= n;
    }

    REP(i, v.size())
    {
        //! ペアが残ってれば数える
        ans += std::min(P[v[i]], S[v[i]] / 2);
    }
    cout << ans << endl;
    return 0;
}

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

H = [int(h) for h in input().split()]

ANS = [True] * N

for _ in range(M):
    A, B = map(int, input().split())
    
    if H[A-1] >= H[B-1]:
        ANS[B-1] = False
    if H[B-1] >= H[A-1]:
        ANS[A-1] = False

print(ANS.count(True))

Measured memory_bytes: 20104
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

int64_t gcd(int64_t a, int64_t b) {
    while (b) {
        int64_t c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main() {
    #ifdef LOCAL_RUN
    freopen("B.in", "r", stdin);
    freopen("B.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    int T;
    cin >> T;

    while (T-- > 0) {
        int64_t a, b, c, d;
        cin >> a >> b >> c >> d;
        if (d < b || a < b) {
            cout << "No\n";
            continue;
        }
        int64_t g = gcd(b, d);
        a %= g;
        a += (b - 1) / g * g;
        if (a > c) {
            cout << "No\n";
            continue;
        }
        cout << "Yes\n";
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int num,a,b;
	scanf("%d%d%d",&num,&a,&b);
	int c=0;
	for(int i=0;i<num;i++)
	{
		int z;
		scanf("%d",&z);
		if(z<a||b<=z)c++;
	}
	printf("%d\n",c);
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;
const double PI = acos(-1);

int main()
{
    char array[26] = {'A', 'B', 'C' , 'D' , 'E' , 'F' , 'G' ,
                      'H' , 'I' , 'J' , 'K' , 'L' , 'M' , 'N' ,
                      'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
                      'W', 'X', 'Y', 'Z'};
    int n;
    string s;
    cin >> n >> s;

    string ans;
    rep(i, s.size()) {
        rep(j, 26) {
            if (s[i] == array[j]) {
                if ((j + n) < 26) ans += array[j + n];
                else ans += array[j + n - 26];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

ll f(ll a,ll b,ll x){
    // 不可能
    if(((a&1)^(b&1))!=(x&1)){
        return LINF;
    }
    if(x==0){
        if(a>=b) return (a-b)/2;
        else return LINF;
    }
    ll ret=2*f(a/2,b/2,x/2);
    chmin(ret,2*f((a-1)/2,(b+1)/2,x/2)+1);
    return ret;
}



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;cin>>n;
    ll a,b,x=0;
    cin>>a>>b;
    rep(i,n-2){
        ll t;cin>>t;
        x^=t;
    }
    ll res=f(a,b,x);
    if(res>=a) cout<<-1<<endl;
    else cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;

int main() {
	int m, n;
	cin >> n >> m;
	vector<int> a;
	for (int i = 0; i < n; ++i) {
		int t;
		cin >> t;
		a.push_back(t);
	}
	int sum = accumulate(a.begin(), a.end(), 0);
	sort(a.rbegin(), a.rend());
	if (a[m-1] >= sum / (4.0 * m)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005
    ll a[MAX_N];
    ll b[MAX_N];

int main() {
    ll n;
    cin >> n;
    
    rep(i,n){cin >> a[i];}
    rep(i,n){cin >> b[i];}

    ll i = n;
    ll ans = 0;


    while(true){
        if(b[i%n] == a[i%n]){
            i++;
        }else if(b[i%n] < a[i%n]){
            cout << "-1" << endl;
            return 0;
        }else if((b[(i-1)%n] < b[i%n]) && (b[i%n] > b[(i+1)%n])){
            ll count = (b[i%n] - a[i%n]) / (b[(i-1)%n] + b[(i+1)%n]);
            if(count == 0){
                cout << "-1" << endl;
                return 0;
            }
            b[i%n] -= (b[(i-1)%n] + b[(i+1)%n]) * count;
            ans += count;
            i++;
            /*
            rep(j,n){
                cout << b[j] << ' ';
            }
            cout << ans << endl;
            */
        }else if(b[i%n] == b[(i+1)%n]){
            cout << "-1" << endl;
            return 0;
        }else{
            i++;
        }

        if(i % (n*2) == 0){
            int flag = 0;
            rep(j,n){
                if(a[j] != b[j]){
                    flag = 1;
                    break;
                }
            }
            if(flag == 0){
                break;
            }
            //cout << i;
        }
    }

    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 3328
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int a, b;
	cin >> a >> b;
	string s = "==";
	if (a > b)
		s = ">";
	else if (a < b)
		s = "<";
	cout << "a " + s + " b" << endl;

	return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    ll a, b; cin >> a >> b;

    if(a < 0 && 0 < b) cout << "Zero" << endl;
    else if(a == 0 || b == 0) cout << "Zero" << endl;
    else if(0 < a) cout << "Positive" << endl;
    else if(b < 0 && (abs(a - b) + 1) % 2 == 0)cout << "Positive" << endl;
    else if(b < 0 && (abs(a - b) + 1) % 2 == 1)cout << "Negative" << endl;
}

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

int main(){
    ll k;
    cin >> k;
    ll sum = 0;
    for(ll a = 1; a <= k; ++a){
        for(ll b = 1; b <= k; ++b){
            for(ll c = 1; c <= k; ++c){
                sum += __gcd(__gcd(a, b), c);
            }
        }
    }    
    cout << sum ;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
long long gcd(long long a,long long b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

long long lcm(long long a,long long b){
    long long g = gcd(a,b);
    return (a/g)*b;
}
int main(){
    long long ans = 1;
    long long N,T;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> T;
        ans = lcm(ans,T);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[100010][4];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    dp[0][0] = 1;
    int ans = 0;
    int times = 1;
    rep(i, S.length()) {
        rep(j, 4) {
            dp[i + 1][j] += dp[i][j] * (1 + (S[i] == '?') * 2)% mod;
            dp[i + 1][j] %= mod;
        }
        //if(S[i] == '?') dp[i][0] += (dp[i][0] * 3) % mod;
        if (S[i] == 'A' || S[i] == '?') {
            dp[i + 1][1] += dp[i][0];
            dp[i + 1][1] %= mod;
        }
        if(S[i] == 'B' || S[i] == '?') {
            dp[i + 1][2] += dp[i][1];
            dp[i + 1][2] %= mod;
        }
        if (S[i] == 'C' || S[i] == '?') {
            dp[i + 1][3] += dp[i][2];
            dp[i + 1][3] %= mod;
        }
        
        // rep(j, 4) {
        //     cout << dp[i + 1][j] << " ";
        // }
        // cout << endl;
    }
   
    //cout << ans << endl;
    cout << dp[S.length()][3] << endl;

    return 0;
}

// A ? ? C



//   A B C
// 1 0 0 0
// 1 1 0 0 
// 1 3 1 0
// 1 ? 6 1
//       7

// A

// AA
// AB
// AC

// AAA
// AAB 1
// AAC
// ABA 1
// ABB 2
// ABC 1
// ACA
// ACB 1
// ACC

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

#define IO  ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define endl '\n'
using namespace std;
int main()
{
    IO
    int n,k,mn=1e9;
    cin>>n>>k;
    k--;
    int arr[n+5];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n);
    for(int i=0;i<n;i++){
        if(i+k>=n) break;
        mn=min(mn,arr[i+k]-arr[i]);
    }
    cout<<mn;
    return 0;
}

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

int main() {
	int n; cin >> n;
	vector<int> prob(n); rep(i, n) cin >> prob[i];
	int m; cin >> m;
	vector<pair<int, int>> drink(m);
	int a, b;
	rep(i, m) {
		cin >> a >> b;
		drink[i] = make_pair(a, b);
	}
	for(const auto &d: drink) {
		int pro = d.first;
		int time = d.second;
		int cnt = 0;
		rep(i, n) {
			if (pro-1 == i) cnt += time;
			else cnt += prob[i];
		}
		cout << cnt << endl;
	}
}

Measured memory_bytes: 256
//
// Created by 伊東麻沙美 on 2019/10/22.
//

#include<iostream>
#include<algorithm>

using namespace std;


int main(){

    int a,b;
    cin>>a>>b;

    if((a+b)%2 == 0){
        cout<<(a+b)/2<<endl;
    }
    if((a+b)%2 == 1){
        std::cout<<"IMPOSSIBLE";
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define mex 1000005
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//vector<int> adj[mex];
//a+b=a^b+2*(a&b)

int main(){
	fast
	char c;
    cin>>c;
   if(c<='Z')
      cout<<'A';
   else
      cout<<'a';
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;
    int A[N];
    rep(i,N) {
        cin>>A[i];
    }
    int ans=3;
    int B[N+3]{};
    rep(i,N+3) B[i]=0;
    B[0]=2;
    B[1]=1;
    if(A[0]!=0) ans=0;
    for(int i=1;i<N;i++){
        B[A[i]+1]++;
        int x=B[A[i]];
        B[A[i]]--;
        ans*=x;
        ans%=MOD;

    }
    cout << ans << endl;




}


Measured memory_bytes: 1792
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    c = 7
    count = 1
    while True:
        if c % k == 0:
            print(count)
            break
        else:
            c = (10 * c + 7) % k
            count += 1

Measured memory_bytes: 62964
n = int(input())
a = list(map(int, input().split()))
ai = max(a)
ai2 = ai/2
aj = a[1] if a[0] == ai else a[0]
d = abs(aj - ai2)
for i in range(1,n):
    tempd = abs(a[i] - ai2)
    if tempd < d and a[i] != ai:
        d = tempd
        aj = a[i]

print(ai, aj)

Measured memory_bytes: 14428
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int ss[26];
int main()
{
    string s;
    cin>>s;
    memset(ss,0,sizeof(ss));
    for(int i=0;i<s.length();i++)
    {
    	if(s[i]=='a') ss[0]=1;
    	if(s[i]=='b') ss[1]=1;
    	if(s[i]=='c') ss[2]=1;
    	if(s[i]=='d') ss[3]=1;
    	if(s[i]=='e') ss[4]=1;
    	if(s[i]=='f') ss[5]=1;
    	if(s[i]=='g') ss[6]=1;
    	if(s[i]=='h') ss[7]=1;
    	if(s[i]=='i') ss[8]=1;
    	if(s[i]=='j') ss[9]=1;
    	if(s[i]=='k') ss[10]=1;
    	if(s[i]=='l') ss[11]=1;
    	if(s[i]=='m') ss[12]=1;
    	if(s[i]=='n') ss[13]=1;
    	if(s[i]=='o') ss[14]=1;
    	if(s[i]=='p') ss[15]=1;
    	if(s[i]=='q') ss[16]=1;
    	if(s[i]=='r') ss[17]=1;
    	if(s[i]=='s') ss[18]=1;
    	if(s[i]=='t') ss[19]=1;
    	if(s[i]=='u') ss[20]=1;
    	if(s[i]=='v') ss[21]=1;
    	if(s[i]=='w') ss[22]=1;
    	if(s[i]=='x') ss[23]=1;
    	if(s[i]=='y') ss[24]=1;
    	if(s[i]=='z') ss[25]=1;
	}
	int k=1;
	for(int i=0;i<26;i++)
	if(ss[i]!=1) 
	{
		k=0;
		printf("%c\n",'a'+i);
		break;
	}
	if(k)
	printf("None\n");
}

Measured memory_bytes: 512
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  const std::set<int> set1 = {1, 3, 5, 7, 8, 10, 12};
  const std::set<int> set2 = {4, 6, 9, 11};

  int x, y;

  std::cin >> x >> y;

  if (set1.count(x) && set1.count(y)) {
    std::cout << "Yes" << std::endl;
  }
  else if (set2.count(x) && set2.count(y)) {
    std::cout << "Yes" << std::endl;
  }
  else {
    std::cout << "No" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

char s[4001], t[4001];
int dp[4001][4001];

int main() 
{
	while (scanf("%s %s", s, t) != EOF){
		memset(dp, 0, sizeof(dp));
		int n = strlen(s);
		int m = strlen(t);
		
		for (int i = 1; i <= n; i++){
			for (int j = 1; j <= m; j++){
				if (s[i - 1] == t[j - 1]){
					dp[i][j] = dp[i - 1][j - 1] + 1;
				}
			}
		}
		
		int maxi = 0;
		
		for (int i = 1; i <= n; i++){
			for (int j = 1; j <= m; j++){
				maxi = max(maxi, dp[i][j]);
			}
		}
		
		printf("%d\n", maxi);
	}
	
	return 0;
}

Measured memory_bytes: 63516